Commit Graph

145 Commits

Author SHA1 Message Date
Daniel Dunbar 671f45e701 DeclPrinter: Indent access specifiers.
llvm-svn: 89552
2009-11-21 09:12:06 +00:00
John McCall e61f2ba7e4 Incremental progress on using declarations. Split UnresolvedUsingDecl into
two classes, one for typenames and one for values;  this seems to have some
support from Doug if not necessarily from the extremely-vague-on-this-point
standard.  Track the location of the 'typename' keyword in a using-typename
decl.  Make a new lookup result for unresolved values and deal with it in
most places.

llvm-svn: 89184
2009-11-18 02:36:19 +00:00
Ted Kremenek 9b124e10a4 Add SourceLocations to ObjCClassDecl for the class identifiers referenced by @class.
llvm-svn: 89170
2009-11-18 00:28:11 +00:00
John McCall 3f746828d7 Instead of hanging a using declaration's target decls directly off the using
decl, create shadow declarations and put them in scope like normal.
Work in progress.

llvm-svn: 89048
2009-11-17 05:59:44 +00:00
Anders Carlsson dee9a30204 Unify the way destructor epilogues are generated for synthesized and regular destructors. Also fix PR5529.
llvm-svn: 89034
2009-11-17 04:44:12 +00:00
Douglas Gregor 35b5753e17 Rename FunctionDecl::isInline/setInline to
FunctionDecl::isInlineSpecified/setInlineSpecified.

llvm-svn: 85305
2009-10-27 21:01:01 +00:00
John McCall 856bbea332 Remove OriginalTypeParmDecl; the original type is the one specified
in the DeclaratorInfo, if one is present.

Preserve source information through template instantiation.  This is made
more complicated by the possibility that ParmVarDecls don't have DIs, which
is possibly worth fixing in the future.

Also preserve source information for function parameters in ObjC method
declarations.

llvm-svn: 84971
2009-10-23 21:48:59 +00:00
Anders Carlsson 46f87dcad4 Make Decl::dump const.
llvm-svn: 82878
2009-09-26 21:58:53 +00:00
John McCall 9dd450bb78 Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely.  Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.

llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
John McCall 2dc078f24e Ensure that the tag decls of friend decls aren't added to the friending class's
decl list, and remove some workarounds that were due to this.  Thanks to Eli for
pointing this out and providing the test case.

llvm-svn: 80745
2009-09-02 00:55:30 +00:00
Anders Carlsson adf36b2379 Add a workaround for decls that come from friend decls pointing to undeclared classes.
llvm-svn: 80438
2009-08-29 20:47:47 +00:00
Anders Carlsson 6df9e076ea In DeclPrinter, assert when asked to print AS_None.
llvm-svn: 80437
2009-08-29 20:36:12 +00:00
Anders Carlsson 601d6e4c7b Add printing of access specifiers to DeclPrinter. The formatting is pretty bad but it works :)
llvm-svn: 80402
2009-08-28 22:39:52 +00:00
Anders Carlsson df5a1c8b5d Improve support for using decls in the decl printer.
llvm-svn: 80386
2009-08-28 19:16:39 +00:00
Benjamin Kramer 89b422c118 Replace cerr with errs().
llvm-svn: 79854
2009-08-23 12:08:50 +00:00
Ted Kremenek c23c7e6a51 Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsRecordType() -> Type::getAs<RecordType>()
  Type::getAsPointerType() -> Type::getAs<PointerType>()
  Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
  Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
  Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
  Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
  Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsTagType() -> Type::getAs<TagType>()
  
And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.

llvm-svn: 77510
2009-07-29 21:53:49 +00:00
Mike Stump 9a9e0c2b17 Add builtin knowledge about longjmp being noreturn. Add printing for
the noreturn attribute.

llvm-svn: 77253
2009-07-27 21:33:40 +00:00
Fariborz Jahanian 2a1b5af130 More work toward initialization of objects
in constructors.

llvm-svn: 76980
2009-07-24 17:57:02 +00:00
Fariborz Jahanian aee31ac316 Patch to accomodate Doug's comment on default
destruction of base/members for each destructor AST.

llvm-svn: 76663
2009-07-21 22:36:06 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Ted Kremenek e3fb4b6524 Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.

llvm-svn: 76098
2009-07-16 19:58:26 +00:00
Fariborz Jahanian 30324d68b1 Fixed a stinko which caused an ast-print test failure.
llvm-svn: 75861
2009-07-15 23:39:31 +00:00
Fariborz Jahanian 24d2383a19 #ifdef'ed out -ast-print of destructors which caused
a test failure, until figuring out what caused the failure.

llvm-svn: 75855
2009-07-15 23:22:45 +00:00
Fariborz Jahanian 16094c2467 Added ASTs to destructor decl AST for default destruction of object's
base/members.

llvm-svn: 75849
2009-07-15 22:34:08 +00:00
Fariborz Jahanian dfbd05d8aa Added a FIXME and prevent crash when listing
a dependent type in the ctor initializer-list.

llvm-svn: 75712
2009-07-14 23:41:35 +00:00
Fariborz Jahanian 44e56ca949 Fixes a minor bug in pretty printing of ctor defs.
llvm-svn: 75549
2009-07-13 23:31:10 +00:00
Fariborz Jahanian 494720b7f7 Added pretty-printing support for constructor definition.
llvm-svn: 75487
2009-07-13 20:18:13 +00:00
Douglas Gregor 1554825e20 Look through vector types when determining the base type of a type for declarator printing. Bug found via the PCH tester
llvm-svn: 74672
2009-07-01 23:58:14 +00:00
Argyrios Kyrtzidis cfbfe78e9e De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Argyrios Kyrtzidis ddcd132a5b Remove the ASTContext parameter from the getBody() methods of Decl and subclasses.
Timings showed no significant difference before and after the commit.

llvm-svn: 74504
2009-06-30 02:35:26 +00:00
Argyrios Kyrtzidis 8a803cc351 Remove the ASTContext parameter from the printing related methods of Decl.
llvm-svn: 74503
2009-06-30 02:35:04 +00:00
Anders Carlsson fb1d776ff0 Keep track of whether a type parameter is actually a type parameter pack.
llvm-svn: 73261
2009-06-12 22:23:22 +00:00
Anders Carlsson 40f8f8d4d7 Minor improvements to template parameter writing.
llvm-svn: 72848
2009-06-04 05:37:43 +00:00
Douglas Gregor 7a1a7cb09d Add a little FIXME for C++ class printing
llvm-svn: 72660
2009-05-31 07:13:39 +00:00
Douglas Gregor 5f478b78c0 AST printing for C++ base classes
llvm-svn: 72617
2009-05-30 06:58:37 +00:00
Douglas Gregor 182319375a Pretty printing and improved representation for namespace alias declarations
llvm-svn: 72616
2009-05-30 06:48:27 +00:00
Eli Friedman 1730424516 Add a hack to prevent us from printing out the __builtin_va_list
declaration in -ast-print mode.

llvm-svn: 72615
2009-05-30 06:35:22 +00:00
Douglas Gregor 3bc6e4c72a Printing for using directives, e.g.,
using namespace std::debug;

Extended UsingDirectiveDecl to store the nested-name-specifier that
precedes the nominated namespace.

llvm-svn: 72614
2009-05-30 06:31:56 +00:00
Douglas Gregor 2d042f1cf4 Never suppress specifiers when printing the parameters of a function
declaration.

llvm-svn: 72613
2009-05-30 05:39:39 +00:00
Eli Friedman ef334fdfa2 Add a Stmt::printPretty overload which takes an ASTContext; start
transitioning callers over to pass one in.

llvm-svn: 72609
2009-05-30 05:03:24 +00:00
Eli Friedman 796358498f Expose an API to print a group of decls (like "int a,b;").
Make StmtPrinter use DeclPrinter to print all declarations.  Merge 
declarations in the limited case of an unnamed TagDecl followed by one 
or more declarations using that TagDecl directly.  Change
SuppressTypeSpecifiers to the more general SuppressSpecifiers, and 
use it to suppress stuff like "typedef" and "extern".  Replace 
OwnedTag with SuppressTag, since it's more convenient to print 
declarations from DeclPrinter at the moment.  
improvements to declaration printing.  Fix pretty-printing for K&R 
function definitions and __builtin_va_arg.

We're now to the point where the pretty-printing output for non-trivial 
programs can actually be piped back into clang.

llvm-svn: 72608
2009-05-30 04:20:30 +00:00
Douglas Gregor 36098ff480 Clean up printing for Objective-C, designated initializers.
llvm-svn: 72602
2009-05-30 00:56:08 +00:00
Douglas Gregor 278f52ec29 Refactor and clean up the AST printer, so that it uses a DeclVisitor,
walks through DeclContexts properly, and prints more of the
information available in the AST. The functionality is still available
via -ast-print, -ast-dump, etc., and also via the new member functions
Decl::dump() and Decl::print().

llvm-svn: 72597
2009-05-30 00:08:05 +00:00