Daniel Jasper
94a56856d2
Fix partial-match-bind-behavior with forEachDescendant() matchers.
...
The problem is that a partial match of an (explicit or implicit) allOf matcher
binds results, i.e.
recordDecl(decl().bind("x"), hasName("A"))
can very well bind a record that is not named "A". With this fix, the common
cases of stumbling over this bug are fixed by the BoundNodesMap overwriting the
results of a partial match. An error can still be created with a weird
combination of anyOf and allOf (see inactive test). We need to decide whether
this is worth fixing, as the fix will have performance impact.
Review: http://llvm-reviews.chandlerc.com/D124
llvm-svn: 168177
2012-11-16 18:39:22 +00:00
NAKAMURA Takumi
fe40a35075
clang/unittests: Fixup corresponding to Doug's r168136.
...
llvm-svn: 168137
2012-11-16 04:40:11 +00:00
Daniel Jasper
0f9f019ff8
Do not use data recursion in ASTMatchFinder.
...
The matchers rely on the complete AST being traversed as shown by the new test cases.
llvm-svn: 168022
2012-11-15 03:29:05 +00:00
Daniel Jasper
33806cdefc
Fix binding of nodes in case of forEach..() matchers.
...
When recursively visiting the generated matches, the aggregated bindings need
to be copied during the recursion. Otherwise, we they might not be properly
overwritten (which is shown by the test), or there might be bound nodes present
that were bound on a different matching branch.
Review: http://llvm-reviews.chandlerc.com/D112
llvm-svn: 167695
2012-11-11 22:14:55 +00:00
David Blaikie
3a0de21233
Fix a source range regression in C++ new expressions with call initializers.
...
Introduced in r167507, discovered in review by Abramo Bagnara.
llvm-svn: 167597
2012-11-08 22:53:48 +00:00
Abramo Bagnara
341ab737e9
Fixed converted ConstantArrayTypeLoc range. Added a missing testcase for ConstructorDecl source range.
...
llvm-svn: 167583
2012-11-08 14:44:42 +00:00
Abramo Bagnara
9b836fb019
Fixed range of implicit MemberExpr.
...
llvm-svn: 167581
2012-11-08 13:52:58 +00:00
David Blaikie
b9db60fbce
Test for source location range of new expressions fixed in r167507.
...
Patch by Philip Craig.
llvm-svn: 167538
2012-11-07 17:17:07 +00:00
Manuel Klimek
e6de22d3dc
Add unit tests for source locations of AST nodes.
...
Patch by Philip Craig.
llvm-svn: 167470
2012-11-06 17:31:40 +00:00
Benjamin Kramer
f9db130715
Escape trigraphs in unittest.
...
llvm-svn: 167359
2012-11-03 20:58:26 +00:00
Manuel Klimek
bd0e2b7111
Insert interception point onStartOfTranslationUnit.
...
Often users of the ASTMatchers want to add tasks that are done once per
translation unit, for example, cleaning up caches. Combined with the
interception point for the end of source file one can add to the factory
creation, this covers the cases we've seen users need.
llvm-svn: 167271
2012-11-02 01:31:03 +00:00
Argyrios Kyrtzidis
2edbc86809
Make the FilenameRange of the InclusionDirective callback more accurate,
...
preserve the macro location of the range end if the filename came from a macro.
Patch by Kim Gräsman!
llvm-svn: 167239
2012-11-01 17:52:58 +00:00
Daniel Jasper
6fc3433b15
Implement descendant matchers for NestedNamespecifiers
...
This implements has(), hasDescendant(), forEach() and
forEachDescendant() for NestedNameSpecifier and NestedNameSpecifierLoc
matchers.
Review: http://llvm-reviews.chandlerc.com/D86
llvm-svn: 167017
2012-10-30 15:42:00 +00:00
Daniel Jasper
e9aa6878c9
Fix ASTMatchersTests to not create an overloaded-virtual warning.
...
llvm-svn: 166921
2012-10-29 10:48:25 +00:00
Daniel Jasper
d29d5fa3f2
Implement has(), hasDescendant(), forEach() and forEachDescendant() for
...
Types, QualTypes and TypeLocs.
Review: http://llvm-reviews.chandlerc.com/D83
llvm-svn: 166917
2012-10-29 10:14:44 +00:00
NAKAMURA Takumi
95fd41aeac
unittests/ToolingTest.cpp: Suppress newFrontendActionFactory.InjectsEndOfSourceFileCallback on Win32 for now. Investigating.
...
llvm-svn: 166674
2012-10-25 09:38:41 +00:00
Manuel Klimek
8246d87db0
Adds the possibility to inject a callback that's called after each translation unit is processed.
...
This is important when one wants to deduplicate results during one run over a translation unit by pointer identity of AST nodes.
llvm-svn: 166671
2012-10-25 08:49:11 +00:00
Douglas Gregor
1452ff155b
Teach the preprocessor to hold onto the preprocessor options.
...
llvm-svn: 166599
2012-10-24 17:46:57 +00:00
Douglas Gregor
40ba1a0191
Update unit tests for HeaderSearch change
...
llvm-svn: 166584
2012-10-24 16:24:38 +00:00
Manuel Klimek
c268745011
Adds the possibility to run ASTMatchFinder over arbitrary AST nodes.
...
llvm-svn: 166567
2012-10-24 14:47:44 +00:00
Douglas Gregor
949cc50962
Tweak include order
...
llvm-svn: 166521
2012-10-23 23:13:50 +00:00
Douglas Gregor
275e8834c1
Buildbot debugging is fun
...
llvm-svn: 166516
2012-10-23 22:55:10 +00:00
Douglas Gregor
3f7d548a16
One last unit-test fix
...
llvm-svn: 166513
2012-10-23 22:43:37 +00:00
Douglas Gregor
edf8e38701
More unit-test fixes
...
llvm-svn: 166511
2012-10-23 22:38:58 +00:00
Douglas Gregor
d8cfd399fa
Fixup unit tests for DiagnosticOptions change
...
llvm-svn: 166509
2012-10-23 22:31:51 +00:00
Daniel Jasper
b0c7b61730
Make hasDeclaration() matcher work inside the memberExpr() matcher.
...
llvm-svn: 166479
2012-10-23 15:46:39 +00:00
Manuel Klimek
7fca93b428
Implements the thisExpr matcher.
...
Patch by Gabor Horvath.
llvm-svn: 166477
2012-10-23 10:40:50 +00:00
Daniel Jasper
632aea92a5
Implement hasParent()-matcher.
...
llvm-svn: 166421
2012-10-22 16:26:51 +00:00
Fariborz Jahanian
9d2f1e753b
[doc parsing] use getParamName to access parameter
...
for current(rewritten) comment and getParamNameAsWritten
to access param name coming with \param marker.
llvm-svn: 166231
2012-10-18 21:42:42 +00:00
Fariborz Jahanian
e0586a574e
Patch for decl printer test of objective-c methods.
...
Patch by Dmitri Gribenko.
llvm-svn: 166209
2012-10-18 19:12:17 +00:00
Daniel Jasper
7943eb5cb5
Fix tests, which accidentally matched implicit code on specific
...
platforms to make buildbots happy.
llvm-svn: 166100
2012-10-17 13:35:36 +00:00
Daniel Jasper
516b02e548
First version of matchers for Types and TypeLocs.
...
Review: http://llvm-reviews.chandlerc.com/D47
llvm-svn: 166094
2012-10-17 08:52:59 +00:00
Douglas Gregor
44d6361ed7
Fix the handling of target options in our unit tests.
...
llvm-svn: 166079
2012-10-17 00:11:35 +00:00
Fariborz Jahanian
14ec3f3acb
structured document comment: patch to provide comment for overriding function
...
template when comment is comming from overridden declaration.
// rdar://12378793
llvm-svn: 165953
2012-10-15 18:58:50 +00:00
Fariborz Jahanian
1c883b9b57
[Doc parsing] This patch searches overridden objc/c++
...
methods looking for documentation on a particular base
class inherited by any method that overrides the base class.
In case of redeclaration, as when objc method is defined
in the implementation, it also looks up for documentation
in class/class extension being redeclared.
llvm-svn: 165643
2012-10-10 18:34:52 +00:00
Daniel Jasper
6b108a617d
CompilationDatabaseTest: Fix another Windows path issue.
...
llvm-svn: 165425
2012-10-08 20:32:51 +00:00
Daniel Jasper
5697f99f98
CompilationDatabase: Use //net paths for tests, as they should be
...
considered absolute on all platforms.
llvm-svn: 165422
2012-10-08 20:08:25 +00:00
Daniel Jasper
fddb32c3d6
FileNameMatchTrie: Use StringRef instead of Twines where possible.
...
llvm-svn: 165412
2012-10-08 18:31:54 +00:00
Daniel Jasper
26cf9c4379
Support symlinks and relative paths in complilation databases.
...
Review: http://llvm-reviews.chandlerc.com/D30
llvm-svn: 165392
2012-10-08 16:08:15 +00:00
Daniel Jasper
6f595397bc
Fix ASTMatchersTests in configurations where
...
"#include <initializer_list>" is unavailable for whatever reason.
llvm-svn: 164944
2012-10-01 15:05:34 +00:00
Daniel Jasper
5901e47e8f
Add matchers for selected C++11 features.
...
Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46
llvm-svn: 164943
2012-10-01 13:40:41 +00:00
Daniel Jasper
0c30337f6b
Fix refersToDeclaration()-matcher and add missing test case. This was
...
broken as of r164656 as TemplateArgument::getAsDecl() now asserts
instead of returning NULL for other template arugment kinds.
llvm-svn: 164896
2012-09-29 15:55:18 +00:00
Dmitri Gribenko
6743e04699
Move the 'find macro by spelling' infrastructure to the Preprocessor class and
...
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.
llvm-svn: 164892
2012-09-29 11:40:46 +00:00
NAKAMURA Takumi
f5a898c305
unittests/AST/StmtPrinterTest.cpp: Suppress a LP64-assumed test, "0x100000000i128 => 4294967296L", for now.
...
LONG_MAX is 2147483647L on common 32 bit and LLP64 (Windows x64).
llvm-svn: 164478
2012-09-24 00:34:18 +00:00
Dmitri Gribenko
24bef9a4e9
As a followup for r164303, add some tests for printing literals that test
...
printing directly rather than through a complicated machinery of ObjC rewriter.
llvm-svn: 164477
2012-09-23 20:29:07 +00:00
Daniel Jasper
87c3d369f1
Add some matchers for basic AST nodes.
...
Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D45
llvm-svn: 164304
2012-09-20 14:12:57 +00:00
Daniel Jasper
83dafaf3db
Fix isDerivedFrom matcher.
...
Without this patch, the isDerivedFrom matcher asserts in the
"assert(ClassDecl != NULL);" in the new test, as a
DependentTemplateSpecilizationType is not a sub-type of
TemplateSpecializationType and also does not offer getAsCXXRecordDecl().
I am not sure why this did not cause problems before. It is now (after
the changed implementation of isDerivedFrom) easier to write a matcher
that actually gets into this branch of the code.
llvm-svn: 164127
2012-09-18 14:17:42 +00:00
Daniel Jasper
417f77684b
Add missing matcher for C-style cast expressions.
...
Patch by Gábor Horváth.
llvm-svn: 164123
2012-09-18 13:36:17 +00:00
Daniel Jasper
848cbe1a0c
Make all VariadicDynCast-Expr-matchers StatementMatchers
...
Having Expr-subclass-matchers being VariadicDynCast-Expr-matchers does
not provide additional type safety and just makes using them harder. In
the clang AST, expressions are always statements and an expression
matcher can be used anywhere, a statement matcher is expected. Any given
matcher definition still has at least one noun.
llvm-svn: 164121
2012-09-18 13:09:13 +00:00
Dmitri Gribenko
ad45ad6fe9
Comment parsing: don't parse comment marker followed by a digit as a command
...
since no Doxygen command starts with a digit.
llvm-svn: 163909
2012-09-14 16:35:35 +00:00