summaryrefslogtreecommitdiff
path: root/unittests
Commit message (Collapse)AuthorAgeFilesLines
* [ASTImporter] Separate unittest filesGabor Marton2019-05-136-1065/+1189
| | | | | | | | | | | | | | | | Summary: Move generic redecl chain tests and visibility tests into their own separate test files. Reviewers: a_sidorin, a.sidorin, shafik Subscribers: mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61786 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360572 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "[clang-format] Keep protobuf "package" statement on one line""Krasimir Georgiev2019-05-101-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Summary: Top-level "package" and "import" statements should generally be kept on one line, for all languages. ---- This reverts commit rL356912. The regression from rL356835 was fixed via rC358275. Reviewers: krasimir, sammccall, MyDeveloperDay, xinz, dchai, klimek Reviewed By: krasimir, xinz, dchai Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60661 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360411 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++20] Add support for explicit(bool), as described in P0892R2.Richard Smith2019-05-094-0/+48
| | | | | | | | Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360311 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Corrected type of integer constant in a test.Balazs Keri2019-05-071-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360156 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] Add -x flags when inferring compile commands for files with ↵Sam McCall2019-05-071-2/+5
| | | | | | | | | | | | | | | | no/invalid extension. Summary: We treat them as headers, as the motivating case is C++ standard library. Reviewers: kadircet Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61633 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360153 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Import TemplateParameterLists in function templates.Balazs Keri2019-05-071-0/+18
| | | | | | | | | | | | | | | | Summary: Correct missing import of TemplateParameterList in function decl. Reviewers: martong, a.sidorin, shafik Reviewed By: martong Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60461 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360132 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r359949 "[clang] adding explicit(bool) from c++2a"Hans Wennborg2019-05-064-48/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused Clang to start erroring on the following: struct S {   template <typename = int> explicit S(); }; struct T : S {}; struct U : T {   U(); }; U::U() {} $ clang -c /tmp/x.cc /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T' U::U() {}    ^ /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted because base class 'S' has no default constructor struct T : S {};            ^ 1 error generated. See discussion on the cfe-commits email thread. This also reverts the follow-ups r359966 and r359968. > this patch adds support for the explicit bool specifier. > > Changes: > - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. > - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. > - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. > - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. > - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. > - Test for Semantic and Serialization were added. > > This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. > Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. > > Patch by Tyker > > Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360024 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++20] Implement P0428R2 - Familiar template syntax for generic lambdasHamza Sood2019-05-042-0/+90
| | | | | | Differential Revision: https://reviews.llvm.org/D36527 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359967 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] adding explicit(bool) from c++2aNicolas Lesser2019-05-044-0/+48
| | | | | | | | | | | | | | | | | | | | | this patch adds support for the explicit bool specifier. Changes: - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. - Test for Semantic and Serialization were added. This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. Patch by Tyker Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359949 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix bug in block comment reflow that joins * and /Owen Pan2019-05-031-0/+18
| | | | | | | | Fixes PR41213 Differential Revision: https://reviews.llvm.org/D61276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359943 91177308-0d34-0410-b5e6-96231b3b80d8
* Added an AST matcher for declarations that are in the `std` namespaceDmitri Gribenko2019-05-031-0/+51
| | | | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61480 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359876 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix a bug in AlignConsecutiveDeclarations.Owen Pan2019-05-011-0/+7
| | | | | | | | Fixes PR37175 Differential Revision: https://reviews.llvm.org/D61222 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359711 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix bug that misses some function-like macro usagesOwen Pan2019-05-011-0/+6
| | | | | | | | Fixes PR41483 Differential Revision: https://reviews.llvm.org/D61297 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359687 91177308-0d34-0410-b5e6-96231b3b80d8
* [LibTooling] Fix broken test after r359574.Yitzhak Mandelbaum2019-04-301-3/+5
| | | | | | r359574 changed the way that failures are reported, which broke the test TransformerTest.NodePartNameDeclRefFailure which detects a faiure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359578 91177308-0d34-0410-b5e6-96231b3b80d8
* [LibTooling] Change Transformer's TextGenerator to a partial function.Yitzhak Mandelbaum2019-04-301-23/+59
| | | | | | | | | | | | | | | | | | | | | | Summary: Changes the signature of the TextGenerator std::function to return an Expected<std::string> instead of std::string to allow for (non-fatal) failures. Previously, we expected that any failures would be expressed with assertions. However, that's unfriendly to running the code in servers or other places that don't want their library calls to crash the program. Correspondingly, updates Transformer's handling of failures in TextGenerators and the signature of `ChangeConsumer`. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61015 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359574 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix gcc "-Wdangling-else" warning. NFCI.Simon Pilgrim2019-04-301-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359551 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix gcc "-Wdangling-else" warnings. NFCI.Simon Pilgrim2019-04-301-3/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359550 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Treat functions without run-time branches as "small".Artem Dergachev2019-04-301-14/+45
| | | | | | | | | | | | | | | | | | Currently we always inline functions that have no branches, i.e. have exactly three CFG blocks: ENTRY, some code, EXIT. This makes sense because when there are no branches, it means that there's no exponential complexity introduced by inlining such function. Such functions also don't trigger various fundamental problems with our inlining mechanism, such as the problem of inlined defensive checks. Sometimes the CFG may contain more blocks, but in practice it still has linear structure because all directions (except, at most, one) of all branches turned out to be unreachable. When this happens, still treat the function as "small". This is useful, in particular, for dealing with C++17 if constexpr. Differential Revision: https://reviews.llvm.org/D61051 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359531 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Add an ImportImpl method to allow customizing Import behavior.Raphael Isemann2019-04-291-9/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We are currently implementing support in LLDB that reconstructs the STL templates from the target program in the expression evaluator. This reconstruction happens during the import process from our debug info AST into the expression evaluation AST, which means we need a way to intercept the ASTImporter import process. This patch adds an protected ImportImpl method that we can overwrite in LLDB to implement our special importing logic (which is essentially just looking into a C++ module that is attached to the target context). Because ImportImpl has to call MapImported/AddToLookup for the decls it creates, this patch also exposes those via a new unified method and checks that we call it when importing decls. Reviewers: martong, balazske, a.sidorin, shafik, a_sidorin Reviewed By: martong, a_sidorin Subscribers: rnkovacs, cfe-commits, lldb-commits, aprantl Tags: #clang Differential Revision: https://reviews.llvm.org/D59485 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359502 91177308-0d34-0410-b5e6-96231b3b80d8
* [Driver] Support priority for multilibsPetr Hosek2019-04-271-0/+24
| | | | | | | | | | | When more than one multilib flag matches, try to select the best possible match based on priority. When two different multilibs with the same same priority match, we still throw an error matching the existing behavior. Differential Revision: https://reviews.llvm.org/D60990 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359359 91177308-0d34-0410-b5e6-96231b3b80d8
* [Testing] Move clangd::Annotations to llvm testing supportIlya Biryukov2019-04-252-28/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: Annotations allow writing nice-looking unit test code when one needs access to locations from the source code, e.g. running code completion at particular offsets in a file. See comments in Annotations.cpp for more details on the API. Also got rid of a duplicate annotations parsing code in clang's code complete tests. Reviewers: gribozavr, sammccall Reviewed By: gribozavr Subscribers: mgorny, hiraditya, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59814 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359179 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang][HeaderSuggestion] Handle the case of dotdot with an absolute pathKadir Cetinkaya2019-04-241-0/+7
| | | | | | | | | | | | | | | | | Summary: Include insertion in clangd was inserting absolute paths when the include directory was an absolute path with a double dot. This patch makes sure double dots are handled both with absolute and relative paths. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60873 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359078 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang][HeaderSearch] Make sure there are no backslashes in suggestedPathKadir Cetinkaya2019-04-241-0/+9
| | | | | | | | Reviewers: sammccall Differential Revision: https://reviews.llvm.org/D60995 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359075 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."Artem Dergachev2019-04-231-0/+19
| | | | | | | | | It now comes with a follow-up fix for the clients of this API in clangd and clang-tidy. Differential Revision: https://reviews.llvm.org/D59977 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359035 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix bug in reflow of block comments containing CR/LFOwen Pan2019-04-231-0/+6
| | | | | | | | Fix PR36119 Differential Revision: https://reviews.llvm.org/D60996 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359029 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTMatchers] Introduce Objective-C matchers `isClassMessage`, ↵Ben Hamilton2019-04-221-0/+54
| | | | | | | | | | | | | | | | | | | | | | | `isClassMethod`, and `isInstanceMethod` Summary: isClassMessage is an equivalent to isInstanceMessage for ObjCMessageExpr, but matches message expressions to classes. isClassMethod and isInstanceMethod check whether a method declaration (or definition) is for a class method or instance method (respectively). Contributed by @mywman! Reviewers: benhamilton, klimek, mwyman Reviewed By: benhamilton, mwyman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60920 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358904 91177308-0d34-0410-b5e6-96231b3b80d8
* [LibTooling] Fix -Wsign-compare after r358697Bjorn Pettersson2019-04-191-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358745 91177308-0d34-0410-b5e6-96231b3b80d8
* Add header guard to Reusables.h [NFC]Ali Tamur2019-04-191-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358724 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Make default bindings to variables actually work.Artem Dergachev2019-04-182-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default RegionStore bindings represent values that can be obtained by loading from anywhere within the region, not just the specific offset within the region that they are said to be bound to. For example, default-binding a character \0 to an int (eg., via memset()) means that the whole int is 0, not just that its lower byte is 0. Even though memset and bzero were modeled this way, it didn't work correctly when applied to simple variables. Eg., in int x; memset(x, 0, sizeof(x)); we did produce a default binding, but were unable to read it later, and 'x' was perceived as an uninitialized variable even after memset. At the same time, if we replace 'x' with a variable of a structure or array type, accessing fields or elements of such variable was working correctly, which was enough for most cases. So this was only a problem for variables of simple integer/enumeration/floating-point/pointer types. Fix loading default bindings from RegionStore for regions of simple variables. Add a unit test to document the API contract as well. Differential Revision: https://reviews.llvm.org/D60742 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358722 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] NFC: Make reusable unittest mocks reusable.Artem Dergachev2019-04-182-52/+61
| | | | | | | | | Put them in a header for other Analyzer unittests to include. Differential Revision: https://reviews.llvm.org/D60739 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358720 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix incorrect formatting of keyword macro definitionOwen Pan2019-04-181-0/+6
| | | | | | | | See PR39719 Differential Revision: https://reviews.llvm.org/D60853 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358710 91177308-0d34-0410-b5e6-96231b3b80d8
* [LibTooling] Extend Transformer to support multiple simultaneous changes.Yitzhak Mandelbaum2019-04-181-70/+105
| | | | | | | | | | | | | | | | Summary: This revision allows users to specify independent changes to multiple (related) sections of the input. Previously, only a single section of input could be selected for replacement. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60408 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358697 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeComplete] Remove obsolete isOutputBinary().Sam McCall2019-04-181-3/+1
| | | | | | | | | | | | | | | | Summary: It's never set to true. Its only effect would be to set stdout to binary mode. Hopefully we have better ways of doing this by now :-) Reviewers: hokein Subscribers: jkorous, arphaman, kadircet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60871 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358696 91177308-0d34-0410-b5e6-96231b3b80d8
* [LibTooling] Add Stencil library for format-string style codegen.Yitzhak Mandelbaum2019-04-182-0/+224
| | | | | | | | | | | | | | | | | | | | | Summary: This file defines the *Stencil* abstraction: a code-generating object, parameterized by named references to (bound) AST nodes. Given a match result, a stencil can be evaluated to a string of source code. A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to nodes (the parameters) and helper code-generation operations. See thread on cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling" for background. Reviewers: sbenza Reviewed By: sbenza Subscribers: ilya-biryukov, mgorny, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59371 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358691 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix indent of trailing raw string param after newlineKrasimir Georgiev2019-04-181-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently clang-format uses ContinuationIndent to indent the contents of a raw string literal that is the last parameter of the function call. This is to achieve formatting similar to trailing: ``` f(1, 2, R"pb( x: y)pb"); ``` However this had the unfortunate consequence of producing format like this: ``` fffffff(1, 2, R"pb( a: b )pb"); ``` This patch makes clang-format consider indenting a trailing raw string param after a newline based off the start of the format delimiter, producing: ``` fffffff(1, 2, R"pb( a: b )pb"); ``` Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60558 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358689 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-tidy] Add fix descriptions to clang-tidy checks.Haojian Wu2019-04-171-82/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Motivation/Context: in the code review system integrating with clang-tidy, clang-tidy doesn't provide a human-readable description of the fix. Usually developers have to preview a code diff (before vs after apply the fix) to understand what the fix does before applying a fix. This patch proposes that each clang-tidy check provides a short and actional fix description that can be shown in the UI, so that users can know what the fix does without previewing diff. This patch extends clang-tidy framework to support fix descriptions (will add implementations for existing checks in the future). Fix descriptions and fixes are emitted via diagnostic::Note (rather than attaching the main warning diagnostic). Before this patch: ``` void MyCheck::check(...) { ... diag(loc, "my check warning") << FixtItHint::CreateReplacement(...); } ``` After: ``` void MyCheck::check(...) { ... diag(loc, "my check warning"); // Emit a check warning diag(loc, "fix description", DiagnosticIDs::Note) << FixtItHint::CreateReplacement(...); // Emit a diagnostic note and a fix } ``` Reviewers: sammccall, alexfh Reviewed By: alexfh Subscribers: MyDeveloperDay, Eugene.Zelenko, aaron.ballman, JonasToth, xazax.hun, jdoerfert, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D59932 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358576 91177308-0d34-0410-b5e6-96231b3b80d8
* [FileSystemStatCache] Update test for new FileSystemStatCache APIHarlan Haskins2019-04-161-5/+6
| | | | | | | | | | | | | | Summary: Update this test to return std::error_code instead of LookupResult. Reviewers: arphaman Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60786 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358511 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix -Wconversion-null warning in GCCReuben Thomas2019-04-151-6/+1
| | | | | | | | | | | | GCC -Wconversion-null warning appeared after 9a63380260860b657b72f07c4f0e61e382ab934a. There was a similar problem already in the past: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20131230/096230.html Patch committed on behalf of @dendibakh Differential Revision: https://reviews.llvm.org/D60726 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358441 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lookup] Invisible decls should not be ambiguous when renaming.Eric Liu2019-04-151-6/+40
| | | | | | | | | | | | | | | | | | Summary: For example, a renamed type in a header file can conflict with declaration in a random file that includes the header, but we should not consider the decl ambiguous if it's not visible at the rename location. This improves consistency of generated replacements when header file is included in different TUs. Reviewers: hokein Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60257 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358378 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] [PR41170] Break after return type ignored with certain ↵Paul Hoad2019-04-151-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | comments positions Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41170 The AlwaysBreakAfterReturn type setting can go wrong if the line ends with a comment ``` void foo() /* comment */ ``` or ``` void foo() // comment ``` It will incorrectly see such functions as Declarations and not Definitions The following code addresses this by looking for function which end with `; <comment>` rather than just `;` or `<comment>` Reviewers: klimek, djasper, reuk, russellmcc, owenpan, sammccall Reviewed By: owenpan Subscribers: lebedev.ri, cfe-commits, sammccall Tags: #clang Differential Revision: https://reviews.llvm.org/D60363 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358375 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Use SpacesBeforeTrailingComments for "option" directiveKrasimir Georgiev2019-04-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: AnnotatingParser::next() is needed to implicitly set TT_BlockComment versus TT_LineComment. On most other paths through AnnotatingParser::parseLine(), all tokens are consumed to achieve that. This change updates one place where this wasn't done. Contributed by @dchai! Reviewers: krasimir Reviewed By: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60541 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358275 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Add AfterCaseLabel to BraceWrappingOwen Pan2019-04-081-14/+36
| | | | | | | | Fixes PR38686 llvm-svn: 52527 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357957 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed every use of ASTImporter::Import to Import_NewBalazs Keri2019-04-081-18/+37
| | | | | | | | | | | | | | Reviewers: a.sidorin, shafik, martong, a_sidorin Reviewed By: a_sidorin Subscribers: rnkovacs, dkrupp, martong, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D55049 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357913 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Optionally insert a space after unary ! operatorReuben Thomas2019-04-081-0/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357908 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413Owen Pan2019-04-071-0/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D60374 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357877 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix Bug 41407Owen Pan2019-04-061-0/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D60359 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357851 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] BreakAfterReturnType ignored on functions with numeric ↵Paul Hoad2019-04-061-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | template parameters Summary: Addresses PR40696 - https://bugs.llvm.org/show_bug.cgi?id=40696 The BreakAfterReturnType didn't work if it had a single arguments which was a template with an integer template parameter ``` int foo(A<8> a) { return a; } ``` When run with the Mozilla style. would not break after the `int` ``` int TestFn(A<8> a) { return a; } ``` This revision resolves this issue by allowing numeric constants to be considered function parameters if if seen inside `<>` Reviewers: djasper, klimek, JonasToth, krasimir, reuk, alexfh Reviewed By: klimek Subscribers: cfe-commits, llvm-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D59309 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357837 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."Artem Dergachev2019-04-051-19/+0
| | | | | | | | | | | This reverts commit r357823. Was breaking clang-tidy! Differential Revision: https://reviews.llvm.org/D59977 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357827 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lexer] NFC: Fix an off-by-one bug in getAsCharRange().Artem Dergachev2019-04-051-0/+19
| | | | | | | | | | | | | | | As the unit test demonstrates, subtracting 1 from the offset was unnecessary. The only user of this function was the plist file emitter (in Static Analyzer and ARCMigrator). It means that a lot of Static Analyzer's plist arrows are in fact off by one character. The patch carefully preserves this completely incorrect behavior and causes no functional change, i.e. no plist format breakage. Differential Revision: https://reviews.llvm.org/D59977 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357823 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix error in NamedDeclPrinterTestDavid Goldman2019-04-051-16/+20
| | | | | | | | Caused by D56924, shouldn't use raw string literals in macros. Differential Revision: https://reviews.llvm.org/D60326 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357799 91177308-0d34-0410-b5e6-96231b3b80d8