summaryrefslogtreecommitdiffstats
path: root/clang/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang][Tooling] Fix windows build-bots after rL364386Kadir Cetinkaya2019-06-261-2/+2
| | | | llvm-svn: 364396
* [clang][Tooling] Infer target and mode from argv[0] when using ↵Kadir Cetinkaya2019-06-261-3/+33
| | | | | | | | | | | | | | | | | | | | | JSONCompilationDatabase Summary: Wraps JSON compilation database with a target and mode adding database wrapper. So that driver can correctly figure out which toolchain to use. Note that clients that wants to make use of this target discovery mechanism needs to link in TargetsInfos and initialize them at startup. Reviewers: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63755 llvm-svn: 364386
* [ASTImporter] Store import errors for DeclsGabor Marton2019-06-253-2/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We add a new member which is a mapping from the already-imported declarations in the "from" context to the error status of the import of that declaration. This map contains only the declarations that were not correctly imported. The same declaration may or may not be included in ImportedDecls. This map is updated continuously during imports and never cleared (like ImportedDecls). In Import(Decl*) we use this mapping, so if there was a previous failed import we return with the existing error. We add/remove from the Lookuptable in consistency with ImportedFromDecls. When we map a decl in the 'to' context to something in the 'from' context then and only then we add it to the lookup table. When we remove a mapping then and only then we remove it from the lookup table. This patch is the first in a series of patches whose aim is to further strengthen the error handling in ASTImporter. Reviewers: a_sidorin, a.sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62373 llvm-svn: 364279
* [Syntax] Do not glue multiple empty PP expansions to a single mappingIlya Biryukov2019-06-241-1/+4
| | | | | | | | | | | | | | | | | | | | | Summary: This change makes sure we have a single mapping for each macro expansion, even if the result of expansion was empty. To achieve that, we take information from PPCallbacks::MacroExpands into account. Previously we relied only on source locations of expanded tokens. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62953 llvm-svn: 364236
* [clang] Adapt ASTMatcher to explicit(bool) specifierGauthier Harnisch2019-06-192-0/+91
| | | | | | | | | | | | | | | | | | | | Summary: Changes: - add an ast matcher for deductiong guide. - allow isExplicit matcher for deductiong guide. - add hasExplicitSpecifier matcher which give access to the expression of the explicit specifier if present. Reviewers: klimek, rsmith, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61552 llvm-svn: 363855
* [clang][test] Add missing LambdaTemplateParams test and migrate from getLocStartJordan Rupprecht2019-06-192-3/+4
| | | | | | These were removed a long time ago in r341573, but this test was missed because it was not in cmake llvm-svn: 363848
* [Syntax] Fix a crash when dumping empty token bufferIlya Biryukov2019-06-191-0/+8
| | | | llvm-svn: 363801
* [Syntax] Add a helper to find expansion by its first spelled tokenIlya Biryukov2019-06-181-0/+78
| | | | | | | | | | | | | | | | Summary: Used in clangd for a code tweak that expands a macro. Reviewers: sammccall Reviewed By: sammccall Subscribers: kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62954 llvm-svn: 363698
* Added AST matcher for ignoring elidable constructorsDmitri Gribenko2019-06-132-9/+145
| | | | | | | | | | | | | | | | | | Summary: Added AST matcher for ignoring elidable move constructors Reviewers: hokein, gribozavr Reviewed By: hokein, gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63149 Patch by Johan Vikström. llvm-svn: 363262
* [test] Reinstate the assignment to the diagnostic log in the unittestAlex Lorenz2019-06-121-0/+4
| | | | | | | | | | from r363009 The diagnostic log is now set to "-" which forces it to use STDERR instead of the filesystem. A new comment is added to explain why the assignment is needed in the test. llvm-svn: 363199
* Fix for r42230, MSVC test failure in DependencyDirectivesSourceMinimizerTest.cppErich Keane2019-06-111-4/+6
| | | | | | | | | | | | r362459 introduced DependencyDirectivesSourceMinimizerTest.cpp, which hits an MSVC bug: developercommunity.visualstudio.com/content/problem/67300/stringifying-raw-string-literal.html This only happens when the parameter to a macro is stringified in the macro. This patch removes the string from the assert so that the warning no longer happens. llvm-svn: 363074
* [libclang] Allow skipping warnings from all included filesNikolai Kosjar2019-06-112-4/+4
| | | | | | | | | | | | Depending on the included files and the used warning flags, e.g. - Weverything, a huge number of warnings can be reported for included files. As processing that many diagnostics comes with a performance impact and not all clients are interested in those diagnostics, add a flag to skip them. Differential Revision: https://reviews.llvm.org/D48116 llvm-svn: 363067
* [ASTImporter] Fix unhandled cases in ASTImporterLookupTableGabor Marton2019-06-111-5/+51
| | | | | | | | | | | | | | | | | | | | | Summary: In most cases the FriendDecl contains the declaration of the befriended class as a child node, so it is discovered during the recursive visitation. However, there are cases when the befriended class is not a child, thus it must be fetched explicitly from the FriendDecl, and only then can we add it to the lookup table. (Note, this does affect only CTU and does not affect LLDB, because we cannot and do not use the ASTImporterLookupTable in LLDB.) Reviewers: a_sidorin, a.sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62064 llvm-svn: 363062
* [Frontend] Avoid creating auxilary files during a unit test. NFCIlya Biryukov2019-06-111-1/+0
| | | | | | | | | | A test added in r363009 logs diagnostics into a file inside current working directory. This breaks when the directory is not writable. This looks like a debugging output in the first place, the test passes without it anyway. llvm-svn: 363041
* [Frontend] SetUpDiagnosticLog should handle unowned diagnostic consumerAlex Lorenz2019-06-101-0/+18
| | | | | | | | | | | | | in the compiler The function SetUpDiagnosticLog that was called from createDiagnostics didn't handle the case where the diagnostics engine didn't own the diagnostics consumer. This is a potential problem for a clang tool, in particular some of the follow-up patches for clang-scan-deps will need this fix. Differential Revision: https://reviews.llvm.org/D63101 llvm-svn: 363009
* clang-format: better handle namespace macrosFrancois Ferrand2019-06-062-0/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Other macros are used to declare namespaces, and should thus be handled similarly. This is the case for crpcut's TESTSUITE macro, or for unittest-cpp's SUITE macro: TESTSUITE(Foo) { TEST(MyFirstTest) { assert(0); } } // TESTSUITE(Foo) This patch deals with this cases by introducing a new option to specify lists of namespace macros. Internally, it re-uses the system already in place for foreach and statement macros, to ensure there is no impact on performance. Reviewers: krasimir, djasper, klimek Reviewed By: klimek Subscribers: acoomans, cfe-commits, klimek Tags: #clang Differential Revision: https://reviews.llvm.org/D37813 llvm-svn: 362740
* [clang][HeaderSearch] Consider all path separators equalKadir Cetinkaya2019-06-061-0/+7
| | | | | | | | | | | | Reviewers: ilya-biryukov, sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62965 llvm-svn: 362731
* [LibTooling] Add insert/remove convenience functions for creating `ASTEdit`s.Yitzhak Mandelbaum2019-06-061-0/+58
| | | | | | | | | | | | | | Summary: `change()` is an all purpose function; the revision adds simple shortcuts for the specific operations of inserting (before/after) or removing source. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62621 llvm-svn: 362707
* [cmake] Remove duplicate TestingSupport library for linkingPengxuan Zheng2019-06-051-1/+0
| | | | | | | | | | | | Summary: This patch cleans up a duplicate use of TestingSupport library. Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62924 llvm-svn: 362637
* [Syntax] Do not depend on llvm targets for Syntax tests. NFCIlya Biryukov2019-06-041-1/+0
| | | | | | They are not required and only slow down the build. llvm-svn: 362530
* Add clang source minimizer that reduces source to directivesAlex Lorenz2019-06-032-0/+509
| | | | | | | | | | | | | | | | | | | | | that might affect the dependency list for a compilation This commit introduces a dependency directives source minimizer to clang that minimizes header and source files to the minimum necessary preprocessor directives for evaluating includes. It reduces the source down to #define, #include, The source minimizer works by lexing the input with a custom fast lexer that recognizes the preprocessor directives it cares about, and emitting those directives in the minimized source. It ignores source code, comments, and normalizes whitespace. It gives up and fails if seems any directives that it doesn't recognize as valid (e.g. #define 0). In addition to the source minimizer this patch adds a -print-dependency-directives-minimized-source CC1 option that allows you to invoke the minimizer from clang directly. Differential Revision: https://reviews.llvm.org/D55463 llvm-svn: 362459
* [clang-format] Allow configuring list of function-like macros that resolve ↵Francois Ferrand2019-05-291-0/+29
| | | | | | | | | | | | | | | | | | | | | | | to a type Summary: Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way similar to `typeof()`. This is enough to: - Prevent misinterpreting declarations of pointers to such types as expressions (`STACK_OF(int) * foo` -> `STACK_OF(int) *foo`), - Avoid surprising line breaks in variable/struct field declarations (`STACK_OF(int)\nfoo;` -> `STACK_OF(int) foo;`, see https://bugs.llvm.org/show_bug.cgi?id=30353). Reviewers: Typz, krasimir, djasper Reviewed By: Typz Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57184 llvm-svn: 361986
* [NFC] clang-format: Use LLVM style in NamespaceEndCommentsFixerTestFrancois Ferrand2019-05-291-148/+149
| | | | | | | | | | As pointed out in https://reviews.llvm.org/D37813#inline-555026, the code which is formatted does not match LLVM formatting style. Technically this is not a problem since these tests bypass most of the formatter, but it can be misleading. llvm-svn: 361984
* [LibTooling] Add `before` and `after` selectors for selecting point-ranges ↵Yitzhak Mandelbaum2019-05-291-3/+54
| | | | | | | | | | | | | | | | | | | | relative to nodes. Summary: The `before` and `after` selectors allow users to specify a zero-length range -- a point -- at the relevant location in an AST-node's source. Point ranges can be useful, for example, to insert a change using an API that takes a range to be modified (e.g. `tooling::change()`). Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62419 llvm-svn: 361955
* [CodeComplete] Set preferred type for qualified-idIlya Biryukov2019-05-281-0/+26
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62514 llvm-svn: 361838
* [clang] Respect TerseOutput when printing lambdasKadir Cetinkaya2019-05-271-0/+14
| | | | | | | | | | | | Reviewers: ilya-biryukov, hokein, sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62487 llvm-svn: 361771
* [ASTImporter] Added visibility context check for CXXRecordDecl.Balazs Keri2019-05-271-2/+35
| | | | | | | | | | | | | | | | | | | Summary: ASTImporter makes now difference between classes with same name in different translation units if these are not visible outside. These classes are not linked into one decl chain. Reviewers: martong, a.sidorin, shafik Reviewed By: shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62312 llvm-svn: 361752
* Add missing newline at end of fileDuncan P. N. Exon Smith2019-05-251-1/+1
| | | | llvm-svn: 361708
* Rename clangToolingRefactor to clangToolingRefactoring for consistency with ↵Nico Weber2019-05-252-2/+2
| | | | | | | | | | its directory See "[cfe-dev] The name of clang/lib/Tooling/Refactoring". Differential Revision: https://reviews.llvm.org/D62420 llvm-svn: 361684
* [LibTooling] Add Explanation parameter to `makeRule`.Yitzhak Mandelbaum2019-05-241-2/+1
| | | | | | | | | | | | | | | | | Summary: Conceptually, a single-case RewriteRule has a matcher, edit(s) and an (optional) explanation. `makeRule` previously only took the matcher and edit(s). This change adds (optional) support for the explanation. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62390 llvm-svn: 361643
* Fix unresolved symbols when linking tools/clang/unittests/Tooling/ToolingTestsThomas Lively2019-05-231-0/+1
| | | | | | | | | | | | | | | | | | | Summary: Add correct cmake dependencies so that `ToolingTests` link successfully. Patch by Guanzhong Chen Reviewers: tlively, aheejin Reviewed By: tlively Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62333 llvm-svn: 361536
* [LibTooling] Update Stencil to use RangeSelectorYitzhak Mandelbaum2019-05-221-22/+23
| | | | | | | | | | | | | | | | | | | Add support for creating a `StencilPart` from any `RangeSelector`, which broadens the scope of `Stencil`. Correspondingly, deprecate Stencil's specialized combinators `node` and `sNode` in favor of using the new `selection` combinator directly (with the appropriate range selector). Reviewers: sbenza Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62160 llvm-svn: 361413
* [LibTooling] Update Transformer to use RangeSelector instead of NodePart enum.Yitzhak Mandelbaum2019-05-221-23/+22
| | | | | | | | | | | | | | | | | Transformer provides an enum to indicate the range of source text to be edited. That support is now redundant with the new (and more general) RangeSelector library, so we remove the custom enum support in favor of supporting any RangeSelector. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62149 llvm-svn: 361392
* Reland r361148 with a fix to the buildbot failure.Ilya Biryukov2019-05-223-0/+677
| | | | | | | Reverted in r361377. Also reland the '.gn' files (reverted in r361389). llvm-svn: 361391
* Revert r361148 "[Syntax] Introduce TokenBuffer, start clangToolingSyntax ↵Russell Gallop2019-05-223-677/+0
| | | | | | | | | | | | library" Also reverted r361264 "[Syntax] Rename TokensTest to SyntaxTests. NFC" which built on it. This is because there were hitting an assert on bots http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast llvm-svn: 361377
* [LibTooling] Address post-commit feedback for r361152Yitzhak Mandelbaum2019-05-211-2/+1
| | | | | | | | | | | | | | Fixes a redundant dependency and moves another to its proper place. Reviewers: thakis Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62201 llvm-svn: 361285
* [Syntax] Rename TokensTest to SyntaxTests. NFCIlya Biryukov2019-05-211-2/+2
| | | | | | | To be more consistent with conventions used in the codebase. The new name will be a better fit when more bits of the syntax library land. llvm-svn: 361264
* [Preamble] Reuse preamble even if an unsaved file does not existNikolai Kosjar2019-05-211-4/+70
| | | | | | | | | | | | | | | | | | | | | When a preamble is created an unsaved file not existing on disk is already part of PrecompiledPreamble::FilesInPreamble. However, when checking whether the preamble can be re-used, a failed stat of such an unsaved file invalidated the preamble, which led to pointless and time consuming preamble regenerations on subsequent reparses. Do not require anymore that unsaved files should exist on disk. This avoids costly preamble invalidations depending on timing issues for the cases where the file on disk might be removed just to be regenerated a bit later. It also allows an IDE to provide in-memory files that might not exist on disk, e.g. because the build system hasn't generated those yet. Differential Revision: https://reviews.llvm.org/D41005 llvm-svn: 361226
* Try to fix build with older gccs after r361152Nico Weber2019-05-211-2/+3
| | | | | | Also merge the cmake change there to the gn build. llvm-svn: 361209
* Renamed `apply` to `select` to avoid ADL conflict with `std::apply`Dmitri Gribenko2019-05-201-37/+37
| | | | | | | | | | | | | | | | Summary: `std::apply` in C++14 and above is defined with two unrestricted arguments, and it wins overload resolution in this case. Reviewers: ilya-biryukov Subscribers: cfe-commits, ymandel Tags: #clang Differential Revision: https://reviews.llvm.org/D62150 llvm-svn: 361170
* [LibTooling] Fix build break in test after r361152.Yitzhak Mandelbaum2019-05-201-1/+2
| | | | | | r361152 broke gcc builds. llvm-svn: 361160
* [LibTooling] Add RangeSelector library for defining source ranges based on ↵Yitzhak Mandelbaum2019-05-202-0/+499
| | | | | | | | | | | | | | | | | | | | | | bound AST nodes. Summary: The RangeSelector library defines a combinator language for specifying source ranges based on bound ids for AST nodes. The combinator approach follows the design of the AST matchers. The RangeSelectors defined here will be used in both RewriteRule, for specifying source affected by edit, and in Stencil for specifying source to use constructively in a replacement. Reviewers: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61774 llvm-svn: 361152
* [Syntax] Introduce TokenBuffer, start clangToolingSyntax libraryIlya Biryukov2019-05-203-0/+677
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: TokenBuffer stores the list of tokens for a file obtained after preprocessing. This is a base building block for syntax trees, see [1] for the full proposal on syntax trees. This commits also starts a new sub-library of ClangTooling, which would be the home for the syntax trees and syntax-tree-based refactoring utilities. [1]: https://lists.llvm.org/pipermail/cfe-dev/2019-February/061414.html Reviewers: gribozavr, sammccall Reviewed By: sammccall Subscribers: mgrang, riccibruno, Eugene.Zelenko, mgorny, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59887 llvm-svn: 361148
* [ASTImporter] Enable disabled but passing testsGabor Marton2019-05-202-13/+3
| | | | | | | | | | | | Reviewers: a_sidorin, a.sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62066 llvm-svn: 361139
* Add a Visit overload for DynTypedNode to ASTNodeTraverserStephen Kelly2019-05-192-0/+225
| | | | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61834 llvm-svn: 361117
* Revert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"Nico Weber2019-05-172-221/+0
| | | | | | | | It fails to build on some bots. Also revert follow-up r361055. llvm-svn: 361059
* [analyzer] Remove the default value arg from getChecker*OptionKristof Umann2019-05-171-17/+14
| | | | | | | | | | | | | | | | | | | Since D57922, the config table contains every checker option, and it's default value, so having it as an argument for getChecker*Option is redundant. By the time any of the getChecker*Option function is called, we verified the value in CheckerRegistry (after D57860), so we can confidently assert here, as any irregularities detected at this point must be a programmer error. However, in compatibility mode, verification won't happen, so the default value must be restored. This implies something else, other than adding removing one more potential point of failure -- debug.ConfigDumper will always contain valid values for checker/package options! Differential Revision: https://reviews.llvm.org/D59195 llvm-svn: 361042
* [LibTooling] Add support to Transformer for composing rules as an ordered ↵Yitzhak Mandelbaum2019-05-171-2/+89
| | | | | | | | | | | | | | | | | | | | choice. This revision updates `RewriteRule` to support multiple subrules that are interpreted as an ordered-choice (apply the first one that matches). With this feature, users can write the rules that appear later in the list of subrules knowing that previous rules' patterns *have not matched*, freeing them from reasoning about those cases in the current pattern. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61335 llvm-svn: 361037
* Add a Visit overload for DynTypedNode to ASTNodeTraverserStephen Kelly2019-05-172-0/+221
| | | | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61834 llvm-svn: 361033
* Move TraversalKind enum to ast_type_traitsStephen Kelly2019-05-161-1/+1
| | | | | | | | | | | | | | | | | Summary: Make it usable outside of ASTMatchFinder. This will make it possible to use this enum to control whether certain implicit nodes are skipped while AST dumping for example. Reviewers: klimek, aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61836 llvm-svn: 360920
OpenPOWER on IntegriCloud