Commit Graph

163 Commits

Author SHA1 Message Date
Alexey Bataev 6f6f3b4baf OpenMP threadprivate with qualified names.
llvm-svn: 181683
2013-05-13 04:18:18 +00:00
Enea Zaffanella acb8ecd664 In VarDecl nodes, store the thread storage class specifier as written.
llvm-svn: 181113
2013-05-04 08:27:07 +00:00
Fariborz Jahanian b5f34681a6 [documenting declaration]: Remove arc liftime qualifiers
when doccumenting declrations in comments.
// rdar://13757500

llvm-svn: 180880
2013-05-01 20:53:21 +00:00
Fariborz Jahanian 9e0758442e [ObjC declaration documentation] declaration of
types involving Objective-C pointers must have
their arc qualifiers elided as they don't 
add any additional info. // rdar://13757500.

llvm-svn: 180860
2013-05-01 17:28:37 +00:00
Richard Smith 852c9db72b C++1y: Allow aggregates to have default initializers.
Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.

llvm-svn: 179958
2013-04-20 22:23:05 +00:00
Richard Smith fd3834f7a1 Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.
llvm-svn: 179447
2013-04-13 02:43:54 +00:00
Rafael Espindola 6ae7e50be4 Add 178663 back.
http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green
before it processed the reverted 178663, so it could not have been the culprit.

Revert "Revert 178663."

This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41.

llvm-svn: 178682
2013-04-03 19:27:57 +00:00
Rafael Espindola 985a3abee4 Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05.

llvm-svn: 178681
2013-04-03 19:22:20 +00:00
Rafael Espindola adea16bd9e Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

llvm-svn: 178663
2013-04-03 15:50:00 +00:00
Alexey Bataev a769e07232 OpenMP threadprivate directive parsing and semantic analysis
llvm-svn: 177705
2013-03-22 06:34:35 +00:00
Michael Han dbe8890be2 Fix empty declaration printing.
Don't print the semicolon when visiting an empty declaration because the semicolon
will be printed as a terminator later.

llvm-svn: 176035
2013-02-25 18:40:11 +00:00
Michael Han 84324357b8 [Sema] Semantic analysis for empty-declaration and attribute-declaration.
Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain
to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these
attributes can be sema checked just as attributes attached to "normal" declarations.

llvm-svn: 175900
2013-02-22 17:15:32 +00:00
Richard Smith e6560761ce Teach -ast-print how to print trailing-return-types.
llvm-svn: 175864
2013-02-22 05:54:51 +00:00
Dmitri Gribenko b614fab39d DeclPrinter: fix CXXConstructExpr printing with implicit default argument
This is an improvement of r173630, that handles the following case:

  struct VirualDestrClass
  {
    VirualDestrClass(int arg);
    virtual ~VirualDestrClass();
  };

  struct ConstrWithCleanupsClass
  {
    ConstrWithCleanupsClass(const VirualDestrClass& cplx = VirualDestrClass(42));
  };

  ConstrWithCleanupsClass cwcNoArg;

That was printed as:

  ConstrWithCleanupsClass cwcNoArg();

llvm-svn: 174296
2013-02-03 23:02:47 +00:00
Enea Zaffanella eb22c870ac Added outer template parameter lists to friend type AST nodes.
llvm-svn: 174050
2013-01-31 09:54:08 +00:00
Dmitri Gribenko 6835e37cec Decl printer: fix CXXConstructExpr with implicit default argument
Patch by Will Wilson.

llvm-svn: 173630
2013-01-27 21:28:24 +00:00
Fariborz Jahanian 7a16a02eec Fixes couple of friend declaration -ast-print bug
found by running -ast-print on all-std-headers.cpp
which caused it to go into infinite loop. Now
-ast-print prints all declarations found in 
all-std-headers.cpp.

llvm-svn: 170928
2012-12-21 21:43:05 +00:00
Alexander Kornienko 90ff607894 Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52

Patch by Philip Craig!

llvm-svn: 170634
2012-12-20 02:09:13 +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
Douglas Gregor c50d4924eb Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type.

llvm-svn: 169919
2012-12-11 22:11:52 +00:00
Fariborz Jahanian 3ec39215f9 More C++ testing of declarations embedded in
<declaration> tag of Comment XML  and fixing 
DeclPrint of templates along the way - wip. 
//rdar://12378714

llvm-svn: 169453
2012-12-06 00:09:40 +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 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
Fariborz Jahanian bfc3ef55be Testing C++ declarations embedded in
<declaration> tag of Comment XML and 
added support for friend declaration printing.
This is wip. // rdar://12378714

llvm-svn: 169346
2012-12-05 00:38:44 +00:00
Fariborz Jahanian 4cf177e238 objective-c blocks: Consider padding due to alignment
after the fixed size block header when generating
captured block variable info. // rdar://12773256

llvm-svn: 169285
2012-12-04 17:20:57 +00:00
Fariborz Jahanian 95759ff807 Testing objective-C declarations embedded in
<declaration> tag of Comment XML and fixed a
missing declaration of ivars private to @implementation
as result of the testing. // rdar://12378714

llvm-svn: 169193
2012-12-04 00:47:33 +00:00
Benjamin Kramer ea70eb30a0 Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code.
Required to pull some functions out of line, but this shouldn't have a perf impact.
No functionality change.

llvm-svn: 169092
2012-12-01 15:09:41 +00:00
Eli Friedman 92125c474a Pretty-print a ParenListExpr in a variable initializer correctly. Patch by Grzegorz Jablonski.
llvm-svn: 166311
2012-10-19 20:36:44 +00:00
Fariborz Jahanian a7d76d2672 [Doc parsing]: This patch adds <Declaration> tag to
XML comment for declarations which pretty-prints
declaration. I had to XFAIL one test annotate-comments.cpp.
This test is currently unmaintainable as written.
Dmitri G., can you see what we can do about this test.
We should change this test such that adding a new tag does not wreck
havoc to the test.

llvm-svn: 166130
2012-10-17 21:58:03 +00:00
Ted Kremenek fa0a0b6628 Teach GetBaseType() about BlockPointerTypes.
llvm-svn: 165742
2012-10-11 20:58:14 +00:00
Dmitri Gribenko 76bb5cabfa Remove redundant semicolons which are null statements.
llvm-svn: 163546
2012-09-10 21:20:09 +00:00
Dmitri Gribenko a9a2af7893 DeclPrinter, terse mode: don't print function bodies
llvm-svn: 162294
2012-08-21 17:47:24 +00:00
Dmitri Gribenko a93a7e8d5e Rename PrintingPolicy::DontRecurseInDeclContext to PrintingPolicy::TerseOutput
to reflect the intention, not the implementation.

llvm-svn: 162293
2012-08-21 17:36:32 +00:00
Dmitri Gribenko 309856ae9f DeclPrinter: add terse output mode and lots of tests
Add a flag PrintingPolicy::DontRecurseInDeclContext to provide "terse" output
from DeclPrinter.  The motivation is to use DeclPrinter to print declarations
in user-friendly format, without overwhelming user with inner detail of the
declaration being printed.

Also add many tests for DeclPrinter.  There are quite a few things that we
print incorrectly: search for WRONG in DeclPrinterTest.cpp -- and these tests
check our output against incorrect output, so that we can fix/refactor/rewrite
the DeclPrinter later.

llvm-svn: 162245
2012-08-20 23:39:06 +00:00
Richard Smith 235341bc88 Store SourceManager pointer on PrintingPolicy in the case where we're dumping,
and remove ASTContext reference (which was frequently bound to a dereferenced
null pointer) from the recursive lump of printPretty functions. In so doing,
fix (at least) one case where we intended to use the 'dump' mode, but that
failed because a null ASTContext reference had been passed in.

llvm-svn: 162011
2012-08-16 03:56:14 +00:00
Richard Smith 52f04a2e8f Don't constant-fold when pretty-printing alignment attribute. This fixes a
potential crasher -- Context is sometimes a null reference (!!) here.

llvm-svn: 162007
2012-08-16 02:43:29 +00:00
Benjamin Kramer 9299d8c298 Do NOT use inline functions with LLVM_ATTRIBUTE_USED.
The function will be emitted into every single TU including the header!

llvm-svn: 161872
2012-08-14 14:50:32 +00:00
David Blaikie f5697e5222 Provide isConst/Volatile on CXXMethodDecl.
This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce
the implementation with other callers (& update those other callers).

Patch contributed by Sam Panzer (panzer@google.com).

llvm-svn: 161647
2012-08-10 00:55:35 +00:00
Eli Friedman 70bc6e6019 Fix a -ast-dump crash.
llvm-svn: 161472
2012-08-08 03:47:15 +00:00
Alexander Kornienko 3db68ee109 Added -ast-dump-filter option to clang -cc1.
llvm-svn: 160784
2012-07-26 16:01:23 +00:00
Richard Smith 2b013185f8 PR13064: Store whether an in-class initializer uses direct or copy
initialization, and use that information to produce the right kind of
initialization during template instantiation.

llvm-svn: 158288
2012-06-10 03:12:00 +00:00
David Blaikie 40ed29730b Revert Decl's iterators back to pointer value_type rather than reference value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

llvm-svn: 158104
2012-06-06 20:45:41 +00:00
Argyrios Kyrtzidis a18347eddb Use raw_ostream in TypePrinter and eliminate uses of temporary std::strings.
Part of rdar://10796159

llvm-svn: 156228
2012-05-05 04:20:37 +00:00
Douglas Gregor b52637051f Print inline for inline namespaces, from Faisal Vali
llvm-svn: 155875
2012-05-01 01:43:38 +00:00
David Blaikie 2d7c57ec1d Remove the ref/value inconsistency in filter_decl_iterator.
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

llvm-svn: 155808
2012-04-30 02:36:29 +00:00
Ted Kremenek c1e4dd0e8e Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

llvm-svn: 151841
2012-03-01 22:07:04 +00:00
Sebastian Redl a935179ab7 Represent C++ direct initializers as ParenListExprs before semantic analysis
instead of having a special-purpose function.

- ActOnCXXDirectInitializer, which was mostly duplication of
  AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days
  ago), is dropped completely.
- MultiInitializer, which was an ugly hack I added, is dropped again.
- We now have the infrastructure in place to distinguish between
  int x = {1};
  int x({1});
  int x{1};
-- VarDecl now has getInitStyle(), which indicates which of the above was used.
-- CXXConstructExpr now has a flag to indicate that it represents list-
   initialization, although this is not yet used.
- InstantiateInitializer was renamed to SubstInitializer and simplified.
- ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which
  always produces a ParenListExpr. Placed that so far failed to convert that
  back to a ParenExpr containing comma operators have been fixed. I'm pretty
  sure I could have made a crashing test case before this.

The end result is a (I hope) considerably cleaner design of initializers.
More importantly, the fact that I can now distinguish between the various
initialization kinds means that I can get the tricky generalized initializer
test cases Johannes Schaub supplied to work. (This is not yet done.)

This commit passed self-host, with the resulting compiler passing the tests. I
hope it doesn't break more complicated code. It's a pretty big change, but one
that I feel is necessary.

llvm-svn: 150318
2012-02-11 23:51:47 +00:00
Benjamin Kramer db0fc5131d Print NamedDecls directly to a raw_ostream where possible.
llvm-svn: 149982
2012-02-07 11:57:57 +00:00