Commit Graph

262 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 3b7793797f Extend stat query APIs to explicitly specify if the query is for
a file or directory, allowing just a stat call if a file descriptor
is not needed.

Doing just 'stat' is faster than 'open/fstat/close'.
This has the effect of cutting down system time for validating the input files of a PCH.

llvm-svn: 169831
2012-12-11 07:48:23 +00:00
Richard Smith bd3051272c PR14558: Compute triviality of special members (etc) at the end of the class
definition, rather than at the end of the definition of the set of nested
classes. We still defer checking of the user-specified exception specification
to the end of the nesting -- we can't check that until we've parsed the
in-class initializers for non-static data members.

llvm-svn: 169805
2012-12-11 01:14:52 +00:00
Daniel Jasper a4396865d0 Addi formatting tests for pointer template parameters.
Fix spacing before ",".

llvm-svn: 169746
2012-12-10 18:59:13 +00:00
Alexander Kornienko 2ca766f32a Clang-format: error recovery for access specifiers
Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 169738
2012-12-10 16:34:48 +00:00
Manuel Klimek e792efd7ba Adding tests since when I was asked whether this works I wasn't
100% sure.

llvm-svn: 169725
2012-12-10 07:08:53 +00:00
Daniel Jasper 2723403f9e Small tweaks to clang-format.
Now not joining keywords with '::' and not putting a space between
a pointer pointer.

llvm-svn: 169594
2012-12-07 09:52:15 +00:00
Fariborz Jahanian 19cd502a1d Fixes Makefile for Format unit tests.
llvm-svn: 169554
2012-12-06 22:29:01 +00:00
Alexander Kornienko 578fdd8968 Clang-format: IndentCaseLabels option, proper namespace handling
Summary: + tests arranged in groups, as their number is already quite large.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits

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

llvm-svn: 169520
2012-12-06 18:03:27 +00:00
Alexander Kornienko ecdc7507ab Clang-format: detect unbalanced braces.
Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits, silvas

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

llvm-svn: 169518
2012-12-06 17:49:17 +00:00
Manuel Klimek c844a46e77 Implements multiple parents in the parent map.
Previously we would match the last visited parent, which in the
case of template instantiations was the last instantiated template.

llvm-svn: 169508
2012-12-06 14:42:48 +00:00
Daniel Jasper 26333c3b6b Improve clang-format's handling of unary operators.
llvm-svn: 169500
2012-12-06 13:16:39 +00:00
Daniel Jasper e9de260418 "<<" alignment for clang-format.
Also, small fix for handling the first token correctly.

Review: http://llvm-reviews.chandlerc.com/D177
llvm-svn: 169488
2012-12-06 09:56:08 +00:00
Fariborz Jahanian de872af437 In DeclPrint add printing of '= default'
in constructors.

llvm-svn: 169440
2012-12-05 22:53:06 +00:00
Fariborz Jahanian 69c403c5c9 In DeclPrint add printing of 'explicit'
constructors.

llvm-svn: 169435
2012-12-05 22:19:06 +00:00
Fariborz Jahanian ae638b3f91 fix comment.
llvm-svn: 169413
2012-12-05 20:10:11 +00:00
Fariborz Jahanian 14ef4790d1 Testing C++ declarations embedded in
<declaration> tag of Comment XML.
Added DeclPrint support for constructors
and fix tests accordingly.
This is wip. // rdar://12378714

llvm-svn: 169412
2012-12-05 19:54:11 +00:00
Alexander Kornienko 37d6c94e28 Clang-format: parse for and while loops
Summary: Adds support for formatting for and while loops.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 169387
2012-12-05 15:06:06 +00:00
Daniel Jasper aa1c920db8 Indentation fixes for clang-format.
- Fix behavior of memoization together with optimization
- Correctly attribute the PenaltyIndentLevel (breaking directly after "(" did
  not count towards the inner level)
- Recognize more tokens as assignments

Review: http://llvm-reviews.chandlerc.com/D172
llvm-svn: 169384
2012-12-05 14:57:28 +00:00
Daniel Jasper 426702dcd0 Small tweaks to automatic formatting.
Recognize '!=' as a binary operator and assume that there are no
type definitions on the RHS of an assignment.

llvm-svn: 169363
2012-12-05 07:51:39 +00:00
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