summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* [ASTImporter] Import SubStmt of CaseStmtGabor Horvath2017-10-181-0/+13
| | | | | | | | Patch by: Rafael Stahl! Differential Revision: https://reviews.llvm.org/D38943 llvm-svn: 316069
* [AST] Add TableGen for StmtDataCollectorsJohannes Altmanninger2017-09-061-1/+1
| | | | | | | | | | | | | | Summary: This adds an option "-gen-clang-data-collectors" to the Clang TableGen that is used to generate StmtDataCollectors.inc. Reviewers: arphaman, teemperor! Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D37383 llvm-svn: 312634
* [analyzer] Make StmtDataCollector customizableJohannes Altmanninger2017-08-232-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This moves the data collection macro calls for Stmt nodes to lib/AST/StmtDataCollectors.inc Users can subclass ConstStmtVisitor and include StmtDataCollectors.inc to define visitor methods for each Stmt subclass. This makes it also possible to customize the visit methods as exemplified in lib/Analysis/CloneDetection.cpp. Move helper methods for data collection to a new module, AST/DataCollection. Add data collection for DeclRefExpr, MemberExpr and some literals. Reviewers: arphaman, teemperor! Subscribers: mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36664 llvm-svn: 311569
* Revert "Lexer: always allow imaginary constants in GNU mode."Tim Northover2017-08-081-1/+1
| | | | | | | This reverts r310423. It was committed by mistake, I intended to commit the improved diagnostics for implicit conversions instead. llvm-svn: 310426
* Lexer: always allow imaginary constants in GNU mode.Tim Northover2017-08-081-1/+1
| | | | llvm-svn: 310423
* Unify and simplify the behavior of the hasDeclaration matcher.Manuel Klimek2017-08-021-29/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Originally, we weren't able to match on Type nodes themselves (only QualType), so the hasDeclaration matcher was initially written to give what we thought are reasonable results for QualType matches. When we chagned the matchers to allow matching on Type nodes, it turned out that the hasDeclaration matcher was by chance written templated enough to now allow hasDeclaration to also match on (some) Type nodes. This patch change the hasDeclaration matcher to: a) work the same on Type and QualType nodes, b) be completely explicit about what nodes we can match instead of just allowing anything with a getDecl() to match, c) explicitly control desugaring only one level in very specific instances. d) adds hasSpecializedTemplate and tagType matchers to allow migrating existing use cases that now need more explicit matchers Note: This patch breaks clang-tools-extra. The corresponding patch there is approved and will land in a subsequent patch. Differential Revision: https://reviews.llvm.org/D27104 llvm-svn: 309809
* Added braces to work around gcc warning in googletest: suggest explicit ↵Galina Kistanova2017-06-151-1/+2
| | | | | | braces to avoid ambiguous 'else'. NFC. llvm-svn: 305507
* ASTPrinter: Objective-C method declarations don't need a space afterAlex Lorenz2017-06-021-1/+1
| | | | | | | | the return type rdar://32332039 llvm-svn: 304553
* Tracking exception specification source locationsMalcolm Parsons2017-01-121-0/+67
| | | | | | | | | | | | | | | | | | | | Summary: We do not currently track the source locations for exception specifications such that their source range can be queried through the AST. This leads to trying to write more complex code to determine the source range for uses like FixItHints (see D18575 for an example). In addition to use within tools like clang-tidy, I think this information may become more important to track as exception specifications become more integrated into the type system. Patch by Don Hinton. Reviewers: rsmith Subscribers: malcolm.parsons, sbarzowski, alexfh, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D20428 llvm-svn: 291771
* Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase ↵David Blaikie2017-01-061-2/+2
| | | | | | | | | | | | | | and CodeCompleteConsumer" Aleksey Shlypanikov pointed out my mistake in migrating an explicit unique_ptr to auto - I was expecting the function returned a unique_ptr, but instead it returned a raw pointer - introducing a leak. Thanks Aleksey! This reapplies r291184, reverted in r291249. llvm-svn: 291270
* Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and ↵David Blaikie2017-01-061-2/+2
| | | | | | | | | | CodeCompleteConsumer" Caused a memory leak reported by asan. Reverting while I investigate. This reverts commit r291184. llvm-svn: 291249
* IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and ↵David Blaikie2017-01-051-2/+2
| | | | | | CodeCompleteConsumer llvm-svn: 291184
* Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}Alexander Kornienko2016-12-132-2/+2
| | | | llvm-svn: 289543
* [RecursiveASTVisitor] Improve post-order traversal unit testMalcolm Parsons2016-12-071-4/+4
| | | | llvm-svn: 288976
* [RecursiveASTVisitor] Fix post-order traversal of UnaryOperatorMalcolm Parsons2016-12-071-2/+7
| | | | | | | | | | Reviewers: aaron.ballman, klimek, doug.gregor, teemperor, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26742 llvm-svn: 288923
* [ASTImporter] Added ability to import AtomicType nodesGabor Horvath2016-11-231-0/+15
| | | | | | | | Patch by: Kareem Khazem Differential Revision: https://reviews.llvm.org/D26328 llvm-svn: 287763
* Make output of -ast-print a valid C++ code.Serge Pavlov2016-11-102-95/+31
| | | | | | | | | | | | | | | | | | Output generated by option -ast-print looks like C/C++ code, and it really is for plain C. For C++ the produced output was not valid C++ code, but the differences were small. With this change the output is fixed and can be compiled. Tests are changed so that output produced by -ast-print is compiled again with the same flags and both outputs are compared. Option -ast-print is extensively used in clang tests but it itself was tested poorly, existing tests only checked that compiler did not crash. There are unit tests in file DeclPrinterTest.cpp, but they test only terse output mode. Differential Revision: https://reviews.llvm.org/D26452 llvm-svn: 286439
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-2/+1
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* [Sema] Store a SourceRange for multi-token builtin typesMalcolm Parsons2016-10-211-0/+90
| | | | | | | | | | | | | | | | | | | Summary: clang-tidy's modernize-use-auto check uses the SourceRange of a TypeLoc when replacing the type with auto. This was producing the wrong result for multi-token builtin types like long long: -long long *ll = new long long(); +auto long *ll = new long long(); Reviewers: alexfh, hokein, rsmith, Prazek, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25363 llvm-svn: 284885
* [ASTImporter] Implement some expression-related AST node import (part 2)Aleksei Sidorin2016-09-281-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Some code cleanup * Add tests not present in http://reviews.llvm.org/D14286 * Integrate a test suite from Serge Pavlov (http://reviews.llvm.org/D14224) * ArrayTypeTraitExpr: serialize sub-expression to avoid keeping it undefined * Implement import of some nodes: - ArrayTypeTraitExpr - ExpressionTraitExpr - OpaqueValueExpr - ArraySubscriptExpr - ExplicitCastExpr - ImplicitValueInitExpr - OffsetOfExpr - CXXThisExpr - CXXThrowExpr - CXXNoexceptExpr - CXXDefaultArgExpr - CXXScalarValueInitExpr - CXXBindTemporaryExpr - CXXTemporaryObjectExpr - MaterializeTemporaryExpr - ExprWithCleanups - StaticAssertDecl - FriendDecl - DecayedType Differential Revision: https://reviews.llvm.org/D14326 llvm-svn: 282572
* [NFC] Header cleanupMehdi Amini2016-07-183-2/+1
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Recommit r274348 and r274349. The Windows failures should be fixed.Vassil Vassilev2016-07-082-0/+124
| | | | | | | | | | | | | | Original commit message: "Add postorder traversal support to the RecursiveASTVisitor. This feature needs to be explicitly enabled by overriding shouldTraversePostOrder() as it has performance drawbacks for the iterative Stmt-traversal. Patch by Raphael Isemann! Reviewed by Richard Smith and Benjamin Kramer." llvm-svn: 274830
* Revert r274348 and r274349 until the Windows failures are fixed.Vassil Vassilev2016-07-012-124/+0
| | | | llvm-svn: 274359
* Add forgotten test to r274348.Vassil Vassilev2016-07-011-0/+123
| | | | llvm-svn: 274349
* Add postorder traversal support to the RecursiveASTVisitor.Vassil Vassilev2016-07-011-0/+1
| | | | | | | | | | | This feature needs to be explicitly enabled by overriding shouldTraversePostOrder() as it has performance drawbacks for the iterative Stmt-traversal. Patch by Raphael Isemann! Reviewed by Richard Smith and Benjamin Kramer. llvm-svn: 274348
* Prune away some unused using decls. NFC.Benjamin Kramer2016-06-082-8/+0
| | | | | | Found by clang's misc-unused-using-decls. llvm-svn: 272156
* [ASTMatchers] Breaking change of `has` matcherPiotr Padlewski2016-05-311-14/+8
| | | | | | | | has matcher can now match to implicit and paren casts http://reviews.llvm.org/D20801 llvm-svn: 271288
* [ASTImporter] Implement some expression-related AST node import.Artem Dergachev2016-04-142-0/+471
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce ASTImporter unit test framework. Fix a memory leak introduced in cf8ccff5: an array is allocated in ImportArray and never freed. Support new node kinds: - GCCAsmStmt - AddrLabelExpr - AtomicExpr - CompoundLiteralExpr - CXXBoolLiteralExpr - CXXNullPtrLiteralExpr - CXXThisExpr - DesignatedInitExpr - GNUNullExpr - ImplicitValueInitExpr - InitListExpr - OpaqueValueExpr - PredefinedExpr - ParenListExpr - StmtExpr - VAArgExpr - BinaryConditionalOperator - ConditionalOperator - FloatingLiteral - StringLiteral - InjectedClassNameType - TemplateTypeParmType - LabelDecl Patch by Aleksei Sidorin! Differential Revision: http://reviews.llvm.org/D14286 llvm-svn: 266292
* Reorder ASTNodeKind::AllKindInfo to match NodeKindId.Alexander Kornienko2016-04-141-3/+14
| | | | | | | | | | | | | | Summary: AllKindInfo is being indexed by NodeKindId, so the order must match. Extended ASTTypeTraits tests to cover this. Reviewers: sbenza Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D19059 llvm-svn: 266268
* Adding new AST matchers for: addrLabelExpr, atomicExpr, ↵Aaron Ballman2016-03-091-0/+19
| | | | | | | | binaryConditionalOperator, designatedInitExpr, designatorCountIs, hasSyntacticForm, implicitValueInitExpr, labelDecl, opaqueValueExpr, parenListExpr, predefinedExpr, requiresZeroInitialization, and stmtExpr. Patch by Aleksei Sidorin. llvm-svn: 263027
* Remove autoconf supportChris Bieneman2016-01-261-19/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Properly track the end location of an exception specification.Aaron Ballman2016-01-121-0/+38
| | | | | | Patch by Adrian Zgorzałek llvm-svn: 257521
* Add a test for r255875 & r255929, comparisons on DynTypeNode wrapped QualType.Richard Trieu2015-12-171-0/+7
| | | | llvm-svn: 255937
* Adjust printQualifiedName to handle unscoped enums in a way similar to ↵Alexander Kornienko2015-11-091-0/+42
| | | | | | | | | | anonymous namespaces. Patch by Sterling Augustine! Differential revision: http://reviews.llvm.org/D14459 llvm-svn: 252488
* [AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.Benjamin Kramer2015-10-231-0/+13
| | | | | | | | | | | | | | | | | | | | This relands r250831 after some fixes to shrink the ParentMap overall with one addtional tweak: nodes with pointer identity (e.g. Decl* and friends) can be store more efficiently so I put them in a separate map. All other nodes (so far only TypeLoc and NNSLoc) go in a different map keyed on DynTypedNode. This further uglifies the code but significantly reduces memory overhead. Overall this change still make ParentMap significantly larger but it's nowhere as bad as before. I see about 25 MB over baseline (pre-r251008) on X86ISelLowering.cpp. If this becomes an issue we could consider splitting the maps further as DynTypedNode is still larger (32 bytes) than a single TypeLoc (16 bytes) but I didn't want to introduce even more complexity now. Differential Revision: http://reviews.llvm.org/D14011 llvm-svn: 251101
* Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."Benjamin Kramer2015-10-211-13/+0
| | | | | | | | | | | | Putting DynTypedNode in the ParentMap bloats its memory foot print. Before the void* key had 8 bytes, now we're at 40 bytes per key which can mean multiple gigabytes increase for large ASTs and this count doesn't even include all the added TypeLoc nodes. Revert until I come up with a better data structure. This reverts commit r250831. llvm-svn: 250889
* [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.Benjamin Kramer2015-10-201-0/+13
| | | | | | | | | | | | | | | | Firstly this changes the type of parent map to be keyed on DynTypedNode to simplify the following changes. This comes with a DenseMapInfo for DynTypedNode, which is a bit incomplete still and will probably only work for parentmap right now. Then the RecursiveASTVisitor in ASTContext is updated and finally ASTMatchers hasParent and hasAncestor learn about the new functionality. Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers. Differential Revision: http://reviews.llvm.org/D13897 llvm-svn: 250831
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Rename AST node matchers to match the AST node names directly. Part of this ↵Aaron Ballman2015-09-174-50/+52
| | | | | | rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects. llvm-svn: 247885
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Move a test from static-assert.cpp to DeclPrinterTestDavid Majnemer2015-06-051-0/+18
| | | | | | | | It's better not to rely on the diagnostics engine to pretty print the argument to decltype. Instead, exercise the functionality in DeclPrinterTest. llvm-svn: 239197
* Fix a few line endings. NFC.Yunzhong Gao2015-05-011-36/+36
| | | | llvm-svn: 236301
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-116-18/+20
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Track the source location of the dot or arrow operator in a MemberExpr.Aaron Ballman2015-03-241-6/+38
| | | | | | Patch by Joe Ranieri! llvm-svn: 233085
* Record correct source range for defaulted/deleted members.Eli Bendersky2015-03-231-0/+12
| | | | | | | | | | | | | | | | | | | Fixes https://llvm.org/bugs/show_bug.cgi?id=20744 struct A { A() = default; }; Previously the source range of the declaration of A ended at the ')'. It should include the '= default' part as well. The same for '= delete'. Note: this will break one of the clang-tidy fixers, which is going to be addessed in a follow-up patch. Differential Revision: http://reviews.llvm.org/D8465 llvm-svn: 233028
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-251-3/+2
| | | | llvm-svn: 230454
* Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl2015-02-251-2/+3
| | | | | | | | | | | | | | | | | This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
* Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl2015-02-241-3/+2
| | | | | | | This reverts commit r230305. Off to fix another round of missing dependencies on various platforms. llvm-svn: 230309
OpenPOWER on IntegriCloud