summaryrefslogtreecommitdiff
path: root/unittests
Commit message (Collapse)AuthorAgeFilesLines
* [clang-format][PR41899] PointerAlignment: Left leads to useless space in ↵Paul Hoad2019-09-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | lambda intializer expression Summary: https://bugs.llvm.org/show_bug.cgi?id=41899 ```auto lambda = [&a = a]() { a = 2; };``` is formatted as ```auto lambda = [& a = a]() { a = 2; };``` With an extra space if PointerAlignment is set to Left > The space "& a" looks strange when there is no type in the lambda's intializer expression. This can be worked around with by setting "PointerAlignment: Right", but ideally "PointerAlignment: Left" would not add a space in this case. Reviewers: klimek, owenpan, krasimir, timwoj Reviewed By: klimek Subscribers: cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D67718 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372249 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and ↵Paul Hoad2019-09-181-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | line starts with tab Summary: clang-format 8.0 crashes with SIGFPE (floating point exception) when formatting following file: app.cpp: void a() { //line starts with '\t' } $ clang-format -style='{TabWidth: 0}' app.cpp Reviewers: owenpan, klimek, russellmcc, timwoj Reviewed By: klimek Subscribers: cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D67670 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372246 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix cleanup of `AnnotatedLine` to include children nodes.Yitzhak Mandelbaum2019-09-171-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: AnnotatedLine has a tree structure, and things like the body of a lambda will be a child of the lambda expression. For example, [&]() { foo(a); }; will have an AnnotatedLine with a child: [&]() {}; '- foo(a); Currently, when the `Cleaner` class analyzes the affected lines, it does not cleanup the lines' children nodes, which results in missed cleanup opportunities, like the lambda body in the example above. This revision extends the algorithm to visit children, thereby fixing the above problem. Patch by Eric Li. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67659 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372129 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: Add support for formatting (some) lambdas with explicit ↵Nico Weber2019-09-131-2/+6
| | | | | | | | | | | | | | template parameters. This patch makes cases work where the lambda's template list doesn't contain any of + - ! ~ / % << | || && ^ == != >= <= ? : true false (see added FIXME). Ports r359967 to clang-format. Differential Revision: https://reviews.llvm.org/D67246 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371854 91177308-0d34-0410-b5e6-96231b3b80d8
* [Clang][ASTImporter] Added visibility check for FunctionTemplateDecl.Balazs Keri2019-09-131-0/+44
| | | | | | | | | | | | | | | | | | Summary: ASTImporter makes now difference between function templates with same name in different translation units if these are not visible outside. Reviewers: martong, a.sidorin, shafik, a_sidorin Reviewed By: a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67490 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371820 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Fix UninstallAbortingLLVMFatalErrorHandler testJan Korous2019-09-121-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371794 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Expose abort()-ing LLVM fatal error handlerJan Korous2019-09-123-0/+46
| | | | | | Differential Revision: https://reviews.llvm.org/D66775 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371787 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][NFC] Fix inconsistent references to checkers as "checks"Kristof Umann2019-09-121-1/+1
| | | | | | | | | | | | | | Traditionally, clang-tidy uses the term check, and the analyzer uses checker, but in the very early years, this wasn't the case, and code originating from the early 2010's still incorrectly refer to checkers as checks. This patch attempts to hunt down most of these, aiming to refer to checkers as checkers, but preserve references to callback functions (like checkPreCall) as checks. Differential Revision: https://reviews.llvm.org/D67140 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371760 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] [unittest] Import LLVMTestingSupport if necessaryMichal Gorny2019-09-121-0/+9
| | | | | | | | | | Add LLVMTestingSupport directory from LLVM_MAIN_SRC_DIR when building clang stand-alone and LLVMTestingSupport library is not present. This is needed to fix stand-alone builds without clang-tools-extra. Differential Revision: https://reviews.llvm.org/D67452 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371733 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] [PR43100] clang-format C# support does not add a space ↵Paul Hoad2019-09-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | between "using" and paren Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=43100 Formatting using statement in C# with clang-format removes the space between using and paren even when SpaceBeforeParens is ! ``` using(FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize : 1)) ``` this change simply overcomes this for when using C# settings in the .clang-format file ``` using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize : 1)) ``` All FormatTests pass.. ``` [==========] 688 tests from 21 test cases ran. (88508 ms total) [ PASSED ] 688 tests. ``` Reviewers: djasper, klimek, owenpan Reviewed By: owenpan Subscribers: llvm-commits, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66662 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371720 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Add new style option IndentGotoLabelsPaul Hoad2019-09-121-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This option determines whether goto labels are indented according to scope. Setting this option to false causes goto labels to be flushed to the left. This is mostly copied from [[ http://lists.llvm.org/pipermail/cfe-dev/2015-September/045014.html | this patch ]] submitted by Christian Neukirchen that didn't make its way into trunk. ``` true: false: int f() { vs. int f() { if (foo()) { if (foo()) { label1: label1: bar(); bar(); } } label2: label2: return 1; return 1; } } ``` Reviewers: klimek, MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: cfe-commits Tags: #clang, #clang-tools-extra Patch by: tetsuo-cpp Differential Revision: https://reviews.llvm.org/D67037 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371719 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-scan-deps] add skip excluded conditional preprocessor block ↵Alex Lorenz2019-09-111-0/+42
| | | | | | | | | | | | | | | preprocessing optimization This commit adds an optimization to clang-scan-deps and clang's preprocessor that skips excluded preprocessor blocks by bumping the lexer pointer, and not lexing the tokens until reaching appropriate #else/#endif directive. The skip positions and lexer offsets are computed when the file is minimized, directly from the minimized tokens. On an 18-core iMacPro with macOS Catalina Beta I got 10-15% speed-up from this optimization when running clang-scan-deps on the compilation database for a recent LLVM and Clang (3511 files). Differential Revision: https://reviews.llvm.org/D67127 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371656 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Apply BAS_AlwaysBreak to C++11 braced listsOwen Pan2019-09-101-0/+10
| | | | | | | | See PR18455. Differential Revision: https://reviews.llvm.org/D67395 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371571 91177308-0d34-0410-b5e6-96231b3b80d8
* [LifetimeAnalysis] don't use raw string literals in macrosMatthias Gehre2019-09-061-29/+23
| | | | | | They broke the AArch64 bots (gcc does not support it) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371241 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland [LifetimeAnalysis] Support more STL idioms (template forward ↵Matthias Gehre2019-09-062-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declaration and DependentNameType) Reland after https://reviews.llvm.org/D66806 fixed the false-positive diagnostics. Summary: This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the gsl::Pointer attribute on the underlaying record after instantiation) inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared, we added the gsl::Pointer on the canonical decl (the forward decl), and later when the template was instantiated, there was no attribute on the definition so it was not instantiated). and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to a incomplete instantiation, and then another was copied from the template definition when the instantiation was completed). We now add the attributes to all redeclarations to fix thos issues and make their usage easier. Reviewers: gribozavr Subscribers: Szelethus, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371182 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename of constants in ASTImporterVisibilityTest. NFC.Balazs Keri2019-09-051-47/+55
| | | | | | | | | | | | | | Reviewers: martong, a.sidorin, shafik Reviewed By: shafik Subscribers: shafik, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67174 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371021 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Added visibility context check for TypedefNameDecl.Balazs Keri2019-09-041-0/+41
| | | | | | | | | | | | | | | | | | | Summary: ASTImporter makes now difference between typedefs and type aliases with same name in different translation units if these are not visible outside. Reviewers: martong, a.sidorin, shafik, a_sidorin Reviewed By: martong, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64480 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370903 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang][test][NFC] Split off fixture from tests.Jan Korous2019-09-032-71/+95
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370825 91177308-0d34-0410-b5e6-96231b3b80d8
* [unittests][AST] CommentParser: don't name variable 'DEBUG'Roman Lebedev2019-09-021-2/+2
| | | | | | | It's may be an already-defined macro name, resulting in compilation errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370650 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] AST structural equivalence to work internally with pairs.Balazs Keri2019-09-021-0/+122
| | | | | | | | | | | | | | | | | | | | | Summary: The structural equivalence check stores now pairs of nodes in the 'from' and 'to' context instead of only the node in 'from' context and a corresponding one in 'to' context. This is needed to handle cases when a Decl in the 'from' context is to be compared with multiple Decls in the 'to' context. Reviewers: martong, a_sidorin Reviewed By: martong, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66538 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370639 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] At import of records re-order indirect fields too.Balazs Keri2019-09-021-6/+34
| | | | | | | | | | | | | | | | | | Summary: Correct order of fields and indirect fields in imported RecordDecl is needed for correct work of record layout calculations. Reviewers: martong, a.sidorin, shafik, a_sidorin Reviewed By: martong, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66866 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370621 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a DirectoryEntryRef that stores both a reference and anAlex Lorenz2019-08-312-2/+2
| | | | | | | | | | | | | | accessed name to the directory entry This commit introduces a parallel API that returns a DirectoryEntryRef to the FileManager, similar to the parallel FileEntryRef API. All uses will have to be update in follow-up patches. The immediate use of the new API in this patch fixes the issue where a file manager was reused in clang-scan-deps, but reported an different file path whenever a framework lookup was done through a symlink. Differential Revision: https://reviews.llvm.org/D67026 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370562 91177308-0d34-0410-b5e6-96231b3b80d8
* ASTReader: Bypass overridden files when reading PCHsDuncan P. N. Exon Smith2019-08-301-0/+50
| | | | | | | | | | | | | | | | | | | | | If contents of a file that is part of a PCM are overridden when reading it, but weren't overridden when the PCM was being built, the ASTReader will emit an error. Now it creates a separate FileEntry for recovery, bypassing the overridden content instead of discarding it. The pre-existing testcase clang/test/PCH/remap-file-from-pch.cpp confirms that the new recovery method works correctly. This resolves a long-standing FIXME to avoid hypothetically invalidating another precompiled module that's already using the overridden contents. This also removes ContentCache-related API that would be unsafe to use across `CompilerInstance`s in an implicit modules build. This helps to unblock us sinking it from SourceManager into FileManager in the future, which would allow us to delete `InMemoryModuleCache`. https://reviews.llvm.org/D66710 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370546 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Do not look up lambda classesGabor Marton2019-08-301-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Consider this code: ``` void f() { auto L0 = [](){}; auto L1 = [](){}; } ``` First we import `L0` then `L1`. Currently we end up having only one CXXRecordDecl for the two different lambdas. And that is a problem if the body of their op() is different. This happens because when we import `L1` then lookup finds the existing `L0` and since they are structurally equivalent we just map the imported L0 to be the counterpart of L1. We have the same problem in this case: ``` template <typename F0, typename F1> void f(F0 L0 = [](){}, F1 L1 = [](){}) {} ``` In StructuralEquivalenceContext we could distinquish lambdas only by their source location in these cases. But we the lambdas are actually structrually equivalent they differn only by the source location. Thus, the solution is to disable lookup completely if the decl in the "from" context is a lambda. However, that could have other problems: what if the lambda is defined in a header file and included in several TUs? I think we'd have as many duplicates as many includes we have. I think we could live with that, because the lambda classes are TU local anyway, we cannot just access them from another TU. Reviewers: a_sidorin, a.sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66348 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370461 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Propagate errors during import of overridden methods.Balazs Keri2019-08-301-0/+44
| | | | | | | | | | | | | | | | | | | Summary: If importing overridden methods fails for a method it can be seen incorrectly as non-virtual. To avoid this inconsistency the method is marked with import error to avoid later use of it. Reviewers: martong, a.sidorin, shafik, a_sidorin Reviewed By: martong, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66933 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370457 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] Migrated APIs that take ownership of objects to unique_ptrDmitri Gribenko2019-08-3014-124/+123
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66960 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370451 91177308-0d34-0410-b5e6-96231b3b80d8
* Added 'inline' to functions defined in headers to avoid ODR violationsDmitri Gribenko2019-08-291-13/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370383 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed FrontendActionFactory::create to return a std::unique_ptrDmitri Gribenko2019-08-291-1/+3
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66947 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370379 91177308-0d34-0410-b5e6-96231b3b80d8
* ArrayRef'ized CompilerInvocation::CreateFromArgsDmitri Gribenko2019-08-271-1/+0
| | | | | | | | | | Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370122 91177308-0d34-0410-b5e6-96231b3b80d8
* Use FileEntryRef for PPCallbacks::HasIncludeAlex Lorenz2019-08-271-0/+35
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was referenced with __has_include() was accessed through a symlink in an earlier run, if the file manager was reused between runs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370081 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Fix name conflict handling with different strategiesGabor Marton2019-08-273-22/+342
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are numorous flaws about the name conflict handling, this patch attempts fixes them. Changes in details: * HandleNameConflict return with a false DeclarationName Hitherto we effectively never returned with a NameConflict error, even if the preceding StructuralMatch indicated a conflict. Because we just simply returned with the parameter `Name` in HandleNameConflict and that name is almost always `true` when converted to `bool`. * Add tests which indicate wrong NameConflict handling * Add to ConflictingDecls only if decl kind is different Note, we might not indicate an ODR error when there is an existing record decl and a enum is imported with same name. But there are other cases. E.g. think about the case when we import a FunctionTemplateDecl with name f and we found a simple FunctionDecl with name f. They overload. Or in case of a ClassTemplateDecl and CXXRecordDecl, the CXXRecordDecl could be the 'templated' class, so it would be false to report error. So I think we should report a name conflict error only when we are 100% sure of that. That is why I think it should be a general pattern to report the error only if the kind is the same. * Fix failing ctu test with EnumConstandDecl In ctu-main.c we have the enum class 'A' which brings in the enum constant 'x' with value 0 into the global namespace. In ctu-other.c we had the enum class 'B' which brought in the same name ('x') as an enum constant but with a different enum value (42). This is clearly an ODR violation in the global namespace. The solution was to rename the second enum constant. * Introduce ODR handling strategies Reviewers: a_sidorin, shafik Differential Revision: https://reviews.llvm.org/D59692 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370045 91177308-0d34-0410-b5e6-96231b3b80d8
* Use FileEntryRef for PPCallbacks::FileSkippedAlex Lorenz2019-08-271-1/+41
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was skipped was included through a symlink in an earlier run, if the file manager was reused between runs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369998 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused variables.Benjamin Kramer2019-08-261-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369965 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format: [JS] handle `as const`.Martin Probst2019-08-261-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: TypeScript 3.4 supports casting into a const type using `as const`: const x = {x: 1} as const; Previously, clang-format would insert a space after the `const`. With this patch, no space is inserted after the sequence `as const`. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66736 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369916 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-enable DependencyScannerTest on windows with the right fixesAlex Lorenz2019-08-241-13/+16
| | | | | | It should now pass. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369832 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable the ScanDepsReuseFilemanager test on WindowsAlex Lorenz2019-08-221-0/+4
| | | | | | | Right now it fails. I'm going to investigate it and fix it in follow-up commits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369688 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the nullPointerConstant() test to get bots back to green.Aaron Ballman2019-08-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369686 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce FileEntryRef and use it when handling includes to report correct ↵Alex Lorenz2019-08-222-0/+119
| | | | | | | | | | | | | | | | | | | | | | | dependencies when the FileManager is reused across invocations This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns a reference to the FileEntry, and the name that was used to access the file. In the case of a VFS with 'use-external-names', the FileEntyRef contains the external name of the file, not the filename that was used to access it. The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations. Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits. Differential Revision: https://reviews.llvm.org/D65907 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369680 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[LifetimeAnalysis] Support more STL idioms (template forward ↵Richard Smith2019-08-222-63/+0
| | | | | | | | | | declaration and DependentNameType)" This reverts commit r369591, because it causes the formerly-reliable -Wreturn-stack-address warning to start issuing false positives. Testcase provided on the commit thread. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369677 91177308-0d34-0410-b5e6-96231b3b80d8
* [LifetimeAnalysis] Support more STL idioms (template forward declaration and ↵Matthias Gehre2019-08-212-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | DependentNameType) Summary: This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the gsl::Pointer attribute on the underlaying record after instantiation) inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared, we added the gsl::Pointer on the canonical decl (the forward decl), and later when the template was instantiated, there was no attribute on the definition so it was not instantiated). and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to a incomplete instantiation, and then another was copied from the template definition when the instantiation was completed). We now add the attributes to all redeclarations to fix thos issues and make their usage easier. Reviewers: gribozavr Subscribers: Szelethus, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369591 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed some dead code in BugReporter and related filesDmitri Gribenko2019-08-211-1/+1
| | | | | | | | | | Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66473 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369504 91177308-0d34-0410-b5e6-96231b3b80d8
* [Syntax] Added function to get macro expansion tokens to TokenBuffer.Johan Vikstrom2019-08-201-0/+23
| | | | | | | | | | | | | | | | Summary: Returns the first token in every mapping where the token is an identifier. This API is required to be able to highlight macro expansions in clangd. Reviewers: hokein, ilya-biryukov Subscribers: kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66470 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369385 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed the 'id' AST matcher, which is superseded by '.bind()'Dmitri Gribenko2019-08-201-18/+18
| | | | | | | | | | | | | | | | | Summary: The 'id' matcher is not even included in the AST Matchers Reference document, so I don't expect there to be a significant number of users. There's no reason to provide two ways to do the exact same thing that only have a minor syntactic difference. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66462 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369380 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix a bug that joins template closer and =Owen Pan2019-08-181-1/+8
| | | | | | | | | | Also fixes the documentation for SpaceBeforeAssignmentOperators. See discussions at https://reviews.llvm.org/D66332 Differential Revision: https://reviews.llvm.org/D66384 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369214 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Fix the bug that joins template closer and > or >>Owen Pan2019-08-161-1/+4
| | | | | | | | | | Also fixes a buggy test case. See PR42404 Differential Revision: https://reviews.llvm.org/D66332 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369157 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Analysis: Silence checkersCsaba Dabis2019-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces a new `analyzer-config` configuration: `-analyzer-config silence-checkers` which could be used to silence the given checkers. It accepts a semicolon separated list, packed into quotation marks, e.g: `-analyzer-config silence-checkers="core.DivideZero;core.NullDereference"` It could be used to "disable" core checkers, so they model the analysis as before, just if some of them are too noisy it prevents to emit reports. This patch also adds support for that new option to the scan-build. Passing the option `-disable-checker core.DivideZero` to the scan-build will be transferred to `-analyzer-config silence-checkers=core.DivideZero`. Reviewed By: NoQ, Szelethus Differential Revision: https://reviews.llvm.org/D66042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369078 91177308-0d34-0410-b5e6-96231b3b80d8
* [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bugJoel E. Denny2019-08-151-5/+68
| | | | | | | | | | | | | | | | | | | | I'd like to add these comments to warn others of problems I encountered when trying to use `RemoveLineIfEmpty`. I originally tried to fix the problem, but I realized I could implement the functionality more easily and efficiently in my calling code where I can make the simplifying assumption that there are no prior edits to the line from which text is being removed. While I've lost the motivation to write a fix, which doesn't look easy, I figure a warning to others is better than silence. I've added a unit test to demonstrate the problem. I don't know how to mark it as an expected failure, so I just marked it disabled. Reviewed By: jkorous Differential Revision: https://reviews.llvm.org/D61466 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369049 91177308-0d34-0410-b5e6-96231b3b80d8
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-1428-137/+137
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368942 91177308-0d34-0410-b5e6-96231b3b80d8
* [CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlockKristof Umann2019-08-141-0/+133
| | | | | | | | | | | | | | | | Previously, collecting CFGElements in a set was practially impossible, because both CFGBlock::operator[] and both the iterators returned it by value. One workaround would be to collect the iterators instead, but they don't really capture the concept of an element, and elements from different iterator types are incomparable. This patch introduces CFGElementRef, a wrapper around a (CFGBlock, Index) pair, and a variety of new iterators and iterator ranges to solve this problem. I guess you could say that this patch took a couple iterations to get right :^) Differential Revision: https://reviews.llvm.org/D65196 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368883 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed ToolExecutor::isSingleProcess, it is not used by anythingDmitri Gribenko2019-08-141-2/+0
| | | | | | | | | | Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66212 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368832 91177308-0d34-0410-b5e6-96231b3b80d8