Commit Graph

90 Commits

Author SHA1 Message Date
Samuel Benzaquen f226e97dff Enhancements for the DynTypedNode
Added ASTNodeKind as a standalone way to represent node kinds and their hierarchy.
This change is to support ongoing work on D815.

Reviewers: klimek

CC: cfe-commits
llvm-svn: 184331
2013-06-19 18:45:24 +00:00
Eli Friedman 2dcbdc0606 Fix source range of CXXNewExpr with parentheses around the type. PR15569.
llvm-svn: 184139
2013-06-17 22:35:10 +00:00
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

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

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Eli Friedman 7152fbe57e Re-commit r183466 with a fix to make the TypeLoc casting machinery work
correctly in the presence of qualified types.

(I had to change the unittest because it was trying to cast a
QualifiedTypeLoc to TemplateSpecializationTypeLoc.)

llvm-svn: 183563
2013-06-07 20:31:48 +00:00
Manuel Klimek 8122830a67 Adds a test that verifies angle bracket locations.
Regression test to make sure TemplateSpecializationTypeLocs have the
correct locations for angle brackets.

llvm-svn: 183514
2013-06-07 11:27:57 +00:00
NAKAMURA Takumi 05f4370074 ASTTests/DeclTest.cpp: Tweak on msvc target to add "-fno-ms-extensions".
MS extensions don't prefer imaginary suffix even with -std=c++11.

llvm-svn: 183301
2013-06-05 06:54:06 +00:00
Benjamin Kramer 8a8557e629 __uint128_t is only available on 64 bit platforms, only test it when it's around.
llvm-svn: 183146
2013-06-03 19:37:18 +00:00
Manuel Klimek a732899cb4 Fix memory leak for APValues that do memory allocation.
This patch ensures that APValues are deallocated with the ASTContext by
registering a deallocation function for APValues to the ASTContext.

Original version of the patch by James Dennett.

llvm-svn: 183101
2013-06-03 13:51:33 +00:00
Fariborz Jahanian 5b637078e1 [Doc parsing] Provide diagnostics for unknown documentation
commands. // rdar://12381408

llvm-svn: 181071
2013-05-03 23:15:20 +00:00
Tanya Lattner 713eef4f7c Add an error to check that all program scope variables are in the constant address space in OpenCL.
llvm-svn: 178906
2013-04-05 20:14:50 +00:00
Dmitri Gribenko bcf7f4d3bb Comment parsing: refactor handling of command markers in AST
* Use the term 'command marker', because the semantics of 'backslash' and 'at'
  commands are the same.  (Talking about 'at commands' makes them look like a
  special entity.)

* Sink the flag down into bitfields, reducing the size of AST nodes.

* Change the flag into an enum for clarity.  Boolean function parameters are
  not very clear.

* Add unittests for new tok::at_command tokens.

llvm-svn: 176461
2013-03-04 23:06:15 +00:00
Fariborz Jahanian e400cb70d4 Some refactoring in my patch on document
command source fidelity. // rdar://13066276

llvm-svn: 176401
2013-03-02 02:39:57 +00:00
Manuel Klimek d4be4084b4 First step towards adding a parent map to the ASTContext.
This does not yet implement the LimitNode approach discussed.

The impact of this is an O(n) in the number of nodes in the AST
reduction of complexity for certain kinds of matchers (as otherwise the
parent map gets recreated for every new MatchFinder).

See FIXMEs in the comments for the direction of future work.

llvm-svn: 176251
2013-02-28 13:21:39 +00:00
Dmitri Gribenko acf2e786d2 Comment parsing: add CommentOptions to allow specifying custom comment block commands
Add an ability to specify custom documentation block comment commands via a new
class CommentOptions.  The intention is that this class will hold future
customizations for comment parsing, including defining documentation comments
with specific numbers of parameters, etc.

CommentOptions instance is a member of LangOptions.

CommentOptions is controlled by a new command-line parameter
-fcomment-block-commands=Foo,Bar,Baz.

llvm-svn: 175892
2013-02-22 14:21:27 +00:00
Richard Smith 9ca910111c PR15095: Use more correct source locations for the InitListExpr we fake up for
vector initialization. Patch by John Stratton!

llvm-svn: 174339
2013-02-05 05:55:57 +00:00
Manuel Klimek aa58b97235 Move commonly useful code for AST testing into MatchVerfier.h.
llvm-svn: 174057
2013-01-31 13:10:40 +00:00
Dmitri Gribenko c137ec8b70 Comment parsing: add more tests for html character references
llvm-svn: 172923
2013-01-19 22:04:44 +00:00
Chris Lattner e8d968f31b fix the unit tests too.
llvm-svn: 172907
2013-01-19 18:30:39 +00:00
Fariborz Jahanian 4419449391 Provide couple of DeclPrint tests for my last patch.
llvm-svn: 170635
2012-12-20 02:20:09 +00:00
Fariborz Jahanian 0389e528ab Audit DeclPrinter with -ast-dump on Cocoa.h and
fix any bad objectiveC syntax coming out of
DeclPrinter. This is on going. Also, introduce a new
PrintPolicy and use it as needed when declaration tag
is to be produced via DeclPrinter.

llvm-svn: 170606
2012-12-19 23:36:00 +00:00
Fariborz Jahanian 9b7ab87738 This is the libclang patch providing minimal API to
use clang's formatter. Currently, formatter is used 
to format declaration tags for xml comments. Since formatter
is in flux and its change will break several of the clang comment
tests, only a single tests is formatted using this facility.
Doug has reviewed and approved it for check-in. 

llvm-svn: 170467
2012-12-18 23:02:59 +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
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
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
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
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
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
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
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
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
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
Dmitri Gribenko 7acbf00f96 Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.
Now we have a list of all commands.  This is a good thing in itself, but it
also enables us to easily implement typo correction for command names.

With this change we have objects that contain information about each command,
so it makes sense to resolve command name just once during lexing (currently we
store command names as strings and do a linear search every time some property
value is needed).  Thus comment token and AST nodes were changed to contain a
command ID -- index into a tables of builtin and registered commands.  Unknown
commands are registered during parsing and thus are also uniformly assigned an
ID.  Using an ID instead of a StringRef is also a nice memory optimization
since ID is a small integer that fits into a common bitfield in Comment class.

This change implies that to get any information about a command (even a command
name) we need a CommandTraits object to resolve the command ID to CommandInfo*.
Currently a fresh temporary CommandTraits object is created whenever it is
needed since it does not have any state.  But with this change it has state --
new commands can be registered, so a CommandTraits object was added to
ASTContext.

Also, in libclang CXComment has to be expanded to include a CXTranslationUnit
so that all functions working on comment AST nodes can get a CommandTraits
object.  This breaks binary compatibility of CXComment APIs.

Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't
need TU parameter anymore, so it was removed.  This is a source-incompatible
change for this C API.

llvm-svn: 163540
2012-09-10 20:32:42 +00:00
Ted Kremenek cdf814900d Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.

llvm-svn: 163050
2012-09-01 05:09:24 +00:00