Commit Graph

83 Commits

Author SHA1 Message Date
Richard Smith 02e85f3bc5 Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).
llvm-svn: 129541
2011-04-14 22:09:26 +00:00
Peter Collingbourne 7d8a0b52d4 Support for printing/dumping static asserts
llvm-svn: 127744
2011-03-16 18:37:27 +00:00
Sebastian Redl fa453cfdc3 Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

llvm-svn: 127537
2011-03-12 11:50:43 +00:00
Douglas Gregor a9d87bc6ac Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the
extremely-lossy NestedNameSpecifier/SourceRange pair it used to use,
improving source-location information.

Various infrastructure updates to support NestedNameSpecifierLoc:
  - AST/PCH (de-)serialization
  - Recursive AST visitor
  - libclang traversal (including the first tests of this
    functionality)

llvm-svn: 126459
2011-02-25 00:36:19 +00:00
Chris Lattner cab02a60d2 Step #2/N of __label__ support: keep pushing LabelDecl forward,
making them be template instantiated in a more normal way and 
make them handle attributes like other decls.

This fixes the used/unused label handling stuff, making it use
the same infrastructure as other decls.

llvm-svn: 125771
2011-02-17 20:34:02 +00:00
John McCall 424cec97bd Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

llvm-svn: 123814
2011-01-19 06:33:43 +00:00
Alexis Hunt 1d7926502f Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

llvm-svn: 123084
2011-01-08 20:30:50 +00:00
Douglas Gregor f550077ef5 Implement support for template template parameter packs, e.g.,
template<template<class> class ...Metafunctions>
    struct apply_to_each;

llvm-svn: 122874
2011-01-05 15:48:55 +00:00
Douglas Gregor eb5a39deb2 When instantiating a non-type template parameter pack, be sure to
extract the appropriate argument from the argument pack (based on the
current substitution index, of course). Simple instantiation of pack
expansions involving non-type template parameter packs now works.

llvm-svn: 122532
2010-12-24 00:15:10 +00:00
Abramo Bagnara 6d8106386c Added missing IgnoreParens().
llvm-svn: 121795
2010-12-14 22:11:44 +00:00
John McCall 5d41378146 Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.

llvm-svn: 120996
2010-12-06 08:20:24 +00:00
Francois Pichet d583da04d0 More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:
struct X {
  X() : au_i1(123) {}
  union {
    int au_i1;
    float au_f1;
  };
};

clang will now deal with au_i1 explicitly as an IndirectFieldDecl.

llvm-svn: 120900
2010-12-04 09:14:42 +00:00
Abramo Bagnara 0e05e24e9c Added struct/class syntactic info for c++0x scoped enum.
llvm-svn: 120828
2010-12-03 18:54:17 +00:00
Douglas Gregor ec0e366163 AST printing for scoped enumerations and enumerations with a fixed underlying type, from Daniel Wallin
llvm-svn: 120576
2010-12-01 16:01:08 +00:00
Douglas Gregor 8fc96fc555 Make sure to print cvr-qualifiers on function declarations
llvm-svn: 119817
2010-11-19 18:44:34 +00:00
Ted Kremenek 3586938d37 Tweak in DeclPrinter printing of uses of copy constructors. Patch by Jim Goodnow II.
llvm-svn: 114235
2010-09-17 23:04:38 +00:00
Ted Kremenek 41994fd45d Fix DeclPrinter to not include '=' in printing when no initializer is provided for a VarDecl. Patch by Jim Goodnow II!
llvm-svn: 113296
2010-09-07 22:21:59 +00:00
John McCall 8e7d656a4a De-memberify the VarDecl and FunctionDecl StorageClass enums.
This lets us remove Sema.h's dependency on Expr.h and Decl.h.

llvm-svn: 112156
2010-08-26 03:08:43 +00:00
Abramo Bagnara d6d2f18905 Added locations and type source info for DeclarationName.
llvm-svn: 110860
2010-08-11 22:01:17 +00:00
Douglas Gregor 1c28331b57 Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,
and create separate decl nodes for forward declarations and the
definition," which appears to be causing significant Objective-C
breakage.

llvm-svn: 110803
2010-08-11 12:19:30 +00:00
Sebastian Redl ab6a088314 - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for forward declarations and the definition.
- Eagerly create ObjCInterfaceTypes for declarations.
- The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another.
- Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated.

llvm-svn: 110610
2010-08-09 21:55:28 +00:00
Ted Kremenek 28e1c9155e Don't print out ivars twice in Decl::print(). Fixes <rdar://problem/8253668>.
llvm-svn: 109833
2010-07-30 00:47:46 +00:00
Craig Silverstein 4a5d086b50 Fix a crashing but trying to print a TemplateTemplateParmDecl
for code like this:
   template<template<typename T> class U> class V {};

The problem is that the DeclPrinter assumed all TemplateDecls
have a getTemplatedClass(), but template template params don't
(so we got a NULL dereference).  The solution is to detect if
we're a template template param, and construct the template
class name ('class U') specially in this case.

OKed by dgregor and chandlerc

llvm-svn: 108007
2010-07-09 20:25:10 +00:00
Daniel Dunbar 219fa69f91 AST: Propogate printing policy to types in a bunch more places.
llvm-svn: 107311
2010-06-30 19:16:48 +00:00
Argyrios Kyrtzidis fa533e7652 Don't ast-print the builtin __[u]int128_t.
llvm-svn: 106212
2010-06-17 10:52:11 +00:00
Douglas Gregor 2ebcae1931 Revert r106099; it broke self-host.
llvm-svn: 106100
2010-06-16 15:23:05 +00:00
Abramo Bagnara bec18dbb88 Added TemplateTypeParmType::getDecl().
llvm-svn: 106099
2010-06-16 14:59:30 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Sebastian Redl 2e702738bb And finally, revert the accidental check-in part of the previous reversion. I'm on a roll.
llvm-svn: 103249
2010-05-07 09:11:09 +00:00
Sebastian Redl 0b4e312566 Revert 103247, it causes lots of test failures.
llvm-svn: 103248
2010-05-07 09:09:23 +00:00
Benjamin Kramer b11416d061 Add raw_ostream operators to NamedDecl for convenience. Switch over all users of getNameAsString on a stream.
The next step is to print the name directly into the stream, avoiding a temporary std::string copy.

llvm-svn: 101632
2010-04-17 09:33:03 +00:00
Douglas Gregor 7ae2d7758f Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

  - CXXBaseOrMemberInitializer now contains only a single initializer
    rather than a set of initialiation arguments + a constructor. The
    single initializer covers all aspects of initialization, including
    constructor calls as necessary but also cleanup of temporaries
    created by the initializer (which we never handled
    before!).

  - Rework + simplify code generation for CXXBaseOrMemberInitializers,
    since we can now just emit the initializer as an initializer.

  - Switched base and member initialization over to the new
    initialization code (InitializationSequence), so that it

  - Improved diagnostics for the new initialization code when
    initializing bases and members, to match the diagnostics produced
    by the previous (special-purpose) code.

  - Simplify the representation of type-checked constructor initializers in
    templates; instead of keeping the fully-type-checked AST, which is
    rather hard to undo at template instantiation time, throw away the
    type-checked AST and store the raw expressions in the AST. This
    simplifies instantiation, but loses a little but of information in
    the AST.

  - When type-checking implicit base or member initializers within a
    dependent context, don't add the generated initializers into the
    AST, because they'll look like they were explicit.

  - Record in CXXConstructExpr when the constructor call is to
  initialize a base class, so that CodeGen does not have to infer it
  from context. This ensures that we call the right kind of
  constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

  - Diagnose default-initialization of a const-qualified class that
    does not have a user-declared default constructor. We had this
    diagnostic specifically for bases and members, but missed it for
    variables. That's fixed now.

  - When defining the implicit constructors, destructor, and
    copy-assignment operator, set the CurContext to that constructor
    when we're defining the body.

llvm-svn: 94952
2010-01-31 09:12:51 +00:00
Anders Carlsson 8911229187 Rename dump to dumpDeclContext, so that call RD->dump() won't dump the decl context by default.
llvm-svn: 91256
2009-12-14 00:51:04 +00:00
Anders Carlsson 538af0906d Add DeclContext::dump.
llvm-svn: 90974
2009-12-09 17:27:46 +00:00
Douglas Gregor 049bdcac49 Implement template instantiation for exception specifications. Also,
print exception specifications on function types and
declarations. Fixes <rdar://problem/7450999>.

There is some poor source-location information here, because we don't
track locations of the types in exception specifications. Filed PR5719.

Failures during template instantiation of the signature of a function
or function template have wrong point-of-instantiation location
information. I'll tackle that with a separate commit.

llvm-svn: 90863
2009-12-08 17:45:32 +00:00
John McCall 3d988d9042 r90313, in which OverloadedFunctionDecl is removed and never spoken of again.
llvm-svn: 90313
2009-12-02 08:47:38 +00:00
Benjamin Kramer 26222b666c Remove VISIBILITY_HIDDEN from lib/AST.
llvm-svn: 90043
2009-11-28 19:03:38 +00:00
Sebastian Redl a6602e9e2a Let using directives refer to namespace aliases. Fixes PR5479.
llvm-svn: 89657
2009-11-23 15:34:23 +00:00
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