Commit Graph

243 Commits

Author SHA1 Message Date
Alexander Kornienko 870f9eb9cc Error recovery part 2
Summary: Adds recovery for structural errors in clang-format.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, silvas

Differential Revision: http://llvm-reviews.chandlerc.com/D164

llvm-svn: 169286
2012-12-04 17:27:50 +00:00
Alexander Kornienko 0ea8e107fc Clang-format error recovery part 1
Reviewers: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D163

llvm-svn: 169278
2012-12-04 15:40:36 +00:00
Alexander Kornienko b7076a2308 Enum formatting implementation
Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D161

llvm-svn: 169272
2012-12-04 14:46:19 +00:00
Manuel Klimek 6137942d09 Fix spelling I ran over while proof-reading tests.
llvm-svn: 169271
2012-12-04 14:42:08 +00:00
Manuel Klimek 5472a52c20 Fixes crash in isDerivedFrom for recursive templates.
llvm-svn: 169262
2012-12-04 13:40:29 +00:00
Daniel Jasper 8b5297117b Small fixes to unary operator recognition and handling of include
directives.

llvm-svn: 169261
2012-12-04 13:02:32 +00:00
Daniel Jasper 9f501295bd Add parameterCountIs() matcher.
llvm-svn: 169257
2012-12-04 11:54:27 +00:00
Daniel Jasper 9b155475a8 Replace workarounds with correct fixes.
Also fix header guard.

http://llvm-reviews.chandlerc.com/D159

llvm-svn: 169254
2012-12-04 10:50:12 +00:00
Chandler Carruth fa0b3bb7ec Really sort the #include lines in unittests/...
I forgot to re-sort after fixing main module headers.

llvm-svn: 169244
2012-12-04 09:53:37 +00:00
Chandler Carruth 320d9666ee Sort the #include lines for unittests/...
I've tried to place sensible headers at the top as main-module headers.

llvm-svn: 169243
2012-12-04 09:45:34 +00:00
NAKAMURA Takumi 1f58e8e194 ASTTests, ASTMatchersTests: Move clangEdit before clangAst in USEDLIB.
llvm-svn: 169236
2012-12-04 08:20:41 +00:00
NAKAMURA Takumi b25f3f7dcb Untabify (in USEDLIBS, Makefile(s)).
llvm-svn: 169235
2012-12-04 08:20:35 +00:00
NAKAMURA Takumi 0e0c3aa560 clang/Lex: [CMake] Update CMakefiles since r169229.
llvm-svn: 169233
2012-12-04 07:40:33 +00:00
Argyrios Kyrtzidis f3d587ea7c Refactor recording the preprocessor conditional directive regions out of
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord.

Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord
without needing a PreprocessingRecord.

llvm-svn: 169229
2012-12-04 07:27:05 +00:00
Argyrios Kyrtzidis 251ad5e06b Introduce CompilationDatabase::getAllCompileCommands() that returns all
compile commands of the database and expose it via the libclang API.

llvm-svn: 169226
2012-12-04 07:26:44 +00:00
Daniel Jasper f793511579 Initial version of formatting library.
This formatting library will be used by a stand-alone clang-format tool
and can also be used when writing other refactorings.

Manuel's original design document:
https://docs.google.com/a/google.com/document/d/1gpckL2U_6QuU9YW2L1ABsc4Fcogn5UngKk7fE5dDOoA/edit

The library can already successfully format itself.

Review: http://llvm-reviews.chandlerc.com/D80
llvm-svn: 169137
2012-12-03 18:12:45 +00:00
Daniel Jasper 856194d00c Make hasDeclaration work for enums.
llvm-svn: 169129
2012-12-03 15:43:25 +00:00
Benjamin Kramer e5015e57c2 Update unit tests not to rely on transitive includes.
llvm-svn: 169096
2012-12-01 17:22:05 +00:00
Douglas Gregor 8c05893746 Fix unit tests for ModuleLoader change in r168961.
llvm-svn: 168962
2012-11-30 00:01:57 +00:00
Richard Smith f41d237bf6 Remove out-of-date comment.
llvm-svn: 168957
2012-11-29 23:09:57 +00:00
NAKAMURA Takumi c2b2b75bd5 ASTTests/StmtPrinterTest/StmtPrinter.TestMSIntegerLiteral: Remove i128 stuff. Conditioning-out in macro argument was not accepted on MS cl.exe.
llvm-svn: 168867
2012-11-29 10:22:40 +00:00
NAKAMURA Takumi b2df62570e ASTTests/StmtPrinterTest/StmtPrinter.TestMSIntegerLiteral: Suppress i128 according to r168856, for now.
I think "i128", that I conditioned out, could be completely removed.
MS Compiler doesn't accept i128. We can assume no one would use i128.

llvm-svn: 168865
2012-11-29 09:57:11 +00:00
Richard Smith 9219d1b764 Allow an ASTConsumer to selectively skip function bodies while parsing. Patch
by Olivier Goffart!

llvm-svn: 168726
2012-11-27 21:31:01 +00:00
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