Commit Graph

482 Commits

Author SHA1 Message Date
Richard Smith 0c4a34b1a0 PR9908: Fix the broken fix for PR9902 to get the template argument lists in the right order.
Also, don't reject alias templates in all ElaboratedTypes: some ElaboratedTypes do not correspond to elaborated-type-specifiers.

llvm-svn: 131342
2011-05-14 15:04:18 +00:00
Richard Trieu de756fbbd7 Patch for PR 7409 - only error on definition of invalid typedefs. Suppress errors for additional uses of this invalid typedef.
llvm-svn: 131043
2011-05-07 01:36:37 +00:00
Richard Smith 3f1b5d077b Implement support for C++0x alias templates.
llvm-svn: 130953
2011-05-05 21:57:07 +00:00
Fariborz Jahanian 4cc5df700e When instantiating a block expression, the instantiated
blockScopeInfo's CapturesCXXThis field need get set as
well. // rdar://9362021. John M. please review.

llvm-svn: 130930
2011-05-05 17:18:12 +00:00
John McCall 8fb0d9d24a Store a parameter index and function prototype depth in every
parameter node and use this to correctly mangle parameter
references in function template signatures.

A follow-up patch will improve the storage usage of these
fields;  here I've just done the lazy thing.

llvm-svn: 130669
2011-05-01 22:35:37 +00:00
John Wiegley 1c0675e155 Parsing/AST support for Structured Exception Handling
Patch authored by Sohail Somani.

Provide parsing and AST support for Windows structured exception handling.

llvm-svn: 130366
2011-04-28 01:08:34 +00:00
John Wiegley 6242b6a688 Implementation of Embarcadero array type traits
Patch authored by John Wiegley.

These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).

llvm-svn: 130351
2011-04-28 00:16:57 +00:00
Chris Lattner cdb591af03 fix PR9474, a crash with -fshort-enum and C++ templates: when instantiating
the enum decl, we need to use an integer type the same size as the enumerator,
which may not be the promoted type with packed enums.

llvm-svn: 130148
2011-04-25 20:37:58 +00:00
John Wiegley f9f6584e95 t/clang/expr-traits
Patch authored by David Abrahams.

These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.

llvm-svn: 130122
2011-04-25 06:54:41 +00:00
Argyrios Kyrtzidis 98feafed27 Fix crashing rdar://9122854 & http://llvm.org/PR9461.
llvm-svn: 129967
2011-04-22 01:18:40 +00:00
Richard Smith dda56e4b4a Support for C++11 (non-template) alias declarations.
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Peter Collingbourne 9114759641 C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages.  The syntax is the same as for C1X.

llvm-svn: 129554
2011-04-15 00:35:48 +00:00
Douglas Gregor 40965fa78a When we transform a C++ exception declaration (e.g., for template
instantiation), be sure to add the transformed declaration into the
current DeclContext. Also, remove the -Wuninitialized hack that works
around this bug. Fixes <rdar://problem/9200676>.

llvm-svn: 129544
2011-04-14 22:32:28 +00:00
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
John Wiegley 0129629fd3 Use ExprResult& instead of Expr *& in Sema
This patch authored by Eric Niebler.

Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr
pointers as in/out parameters (Expr *&).  This is especially true for the
routines that apply implicit conversions to nodes in-place.  This design is
workable only as long as those conversions cannot fail.  If they are allowed
to fail, they need a way to report their failures.  The typical way of doing
this in clang is to use an ExprResult, which has an extra bit to signal a
valid/invalid state.  Returning ExprResult is de riguour elsewhere in the Sema
interface.  We suggest changing the Expr *& parameters in the Sema interface
to ExprResult &.  This increases interface consistency and maintainability.

This interface change is important for work supporting MS-style C++
properties.  For reasons explained here
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013180.html>,
seemingly trivial operations like rvalue/lvalue conversions that formerly
could not fail now can.  (The reason is that given the semantics of the
feature, getter/setter method lookup cannot happen until the point of use, at
which point it may be found that the method does not exist, or it may have the
wrong type, or overload resolution may fail, or it may be inaccessible.)

llvm-svn: 129143
2011-04-08 18:41:53 +00:00
Chandler Carruth 3d7e3daaa6 Fix an error in TreeTransform where we failed to copy the TemplateName's
location into a TemplateSpecializationTypeLoc. These were found using
a hand-written program to inspect every source location in
TemplateSpecializationTypeLocs and Valgrind. I don't know of any way to
test them in Clang's existing test suite sadly.

Example code that triggers the ElaboratedType case:
  template <typename T> struct X1 {
    template <typename U> struct X1_1 {
      int x;
    };
  };

  template <typename T, typename U> struct X2 {
    typename X1<T>::template X1_1<U> B;
  };

  X2<char, int> x2;

The other fix was simply spotted by inspection. I audited all constructions of
[Dependent]TemplateSpecializationTypeLocs in TreeTransform.h, and the rest set
the TemplateNameLoc properly.

llvm-svn: 128702
2011-04-01 02:03:23 +00:00
Abramo Bagnara f2a79d94e4 Forgotten part of previous commit.
llvm-svn: 127536
2011-03-12 11:17:06 +00:00
Abramo Bagnara 6b6f051e5e Renamed OffsetOfNode::getRange to getSourceRange for uniformity.
llvm-svn: 127534
2011-03-12 09:45:03 +00:00
Peter Collingbourne e190dee7a5 Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof.  Original
patch by Guy Benyei.

llvm-svn: 127475
2011-03-11 19:24:49 +00:00
Abramo Bagnara dff1930bf7 Fixed source range for all DeclaratorDecl's.
llvm-svn: 127225
2011-03-08 08:55:46 +00:00
Douglas Gregor 11ddf1361d When rebuilding a dependent template specialization type to another
dependent template specialization type, make sure to set the keyword
location. Fixes some valgrind issues introduced in r127150.

llvm-svn: 127159
2011-03-07 15:13:34 +00:00
Douglas Gregor 43f788f16c When transforming a dependent template specialization type, make sure
to set the source-location information for the template arguments to
the *transformed* source-location information, not the original
source-location information. Fixes <rdar://problem/8986308> (a libc++
SFINAE issue) and the Boost.Polygon failure.

llvm-svn: 127150
2011-03-07 02:33:33 +00:00
Douglas Gregor 69735112d0 Fix copy-and-paste typo in the transformation of Microsoft __uuidof expressions, from Eric Niebler via John Wiegley
llvm-svn: 127123
2011-03-06 17:40:41 +00:00
Douglas Gregor 20bf98b5f8 When transforming a substituted template type parameter, try to
transform the type that replaces the template type parameter. In the
vast majority of cases, there's nothing to do, because most template
type parameters are replaced with something non-dependent that doesn't
need further transformation. However, when we're dealing with the
default template arguments of template template parameters, we might
end up replacing a template parameter (of the template template
parameter) with a template parameter of the enclosing template. 
 
This addresses part of PR9016, but not within function
templates. That's a separate issue.

llvm-svn: 127091
2011-03-05 17:19:27 +00:00
Abramo Bagnara 5093578471 Improved MemberPointerType source locations.
llvm-svn: 127085
2011-03-05 14:42:21 +00:00
Douglas Gregor 23648d7e3b When constructing source-location information for a
DependentTemplateSpecializationType during tree transformation, retain
the NestedNameSpecifierLoc as it was used to translate the template
name, rather than reconstructing it from the template name.

Fixes PR9401.

llvm-svn: 127015
2011-03-04 18:53:13 +00:00
Douglas Gregor 739b107af8 When we use the default template arguments of a template template
parameter, save the instantiated default template arguments along with
the explicitly-specified template argument list. That way, we prefer
the default template template arguments corresponding to the template
template parameter rather than those of its template template argument.

This addresses the likely direction of C++ core issue 150, and fixes
PR9353/<rdar://problem/9069136>, bringing us closer to the behavior of
EDG and GCC.

llvm-svn: 126920
2011-03-03 02:41:12 +00:00
Douglas Gregor cf256c1297 Eliminate an unnecessary TemporaryBase object from TreeTransform
llvm-svn: 126857
2011-03-02 19:02:55 +00:00
Douglas Gregor 1ee2406369 Kill off the
TreeTransform::TransformDependentTemplateSpecializationType() with
poor source-location information handling. All of the
CXXScopeSpec::MakeTrivial() and
NestedNameSpecifierLocBuilder::MakeTrivial() callers actually make
sense now.

llvm-svn: 126856
2011-03-02 18:57:38 +00:00
Douglas Gregor 1abdf36a2c Eliminate TreeTransform::RebuildNestedNameSpecifier(), all four of
them, which are no longer used.

llvm-svn: 126855
2011-03-02 18:54:26 +00:00
Douglas Gregor d4c41bcd7f Eliminate an unnecessary use of CXXScopeSpec::MakeTrivial. We have proper nested-name-specifier source-location information in DependentTemplateSpecializationTypeLocs now
llvm-svn: 126854
2011-03-02 18:52:42 +00:00
Douglas Gregor fd35cde35e Kill off TreeTransform::TransformNestedNameSpecifier() in favor of the
source-location-preserving
TreeTransform::TranformNestedNameSpecifierLoc(). No functionality
change: the victim had no callers (that themselves had callers) anyway.

llvm-svn: 126853
2011-03-02 18:50:38 +00:00
Douglas Gregor df846d11c1 Kill off the TreeTransform::TransformTemplateName overload that has
poor source-location information.

llvm-svn: 126852
2011-03-02 18:46:51 +00:00
Douglas Gregor 579c15f5d6 Kill off one of the TreeTransform::TransformTypeInObjectScope()
overloads (the one with the poor source-location information).

llvm-svn: 126851
2011-03-02 18:32:08 +00:00
Douglas Gregor 9db535035d Start migrating TreeTransform's TransformTemplateName over to version
that preserve source-location information. This commit adds more
redundancy than it removes; WIP.

llvm-svn: 126849
2011-03-02 18:07:45 +00:00
Douglas Gregor 9d80212115 Push nested-name-specifier source location information into template
template arguments. I believe that this is the last place in the AST
where we were storing a source range for a nested-name-specifier
rather than a proper nested-name-specifier location structure. (Yay!)

There is still a lot of cleanup to do in the TreeTransform, which
doesn't take advantage of nested-name-specifiers with source-location
information everywhere it could.

llvm-svn: 126844
2011-03-02 17:09:35 +00:00
Douglas Gregor c52264e719 When we're substituting into a parameter-type-list nested inside the pattern
of an expansion, and we have a paramameter that is not a parameter
pack, don't suppress substitution of parameter packs within this
context.

llvm-svn: 126819
2011-03-02 02:04:06 +00:00
Douglas Gregor a7a795bed1 Push nested-name-specifier source-location information into dependent
template specialization types. There are still a few rough edges to
clean up with some of the parser actions dropping
nested-name-specifiers too early.

llvm-svn: 126776
2011-03-01 20:11:18 +00:00
Douglas Gregor 844cb50266 Reinstate the introduction of source-location information for
nested-name-speciciers within elaborated type names, e.g.,
 
  enum clang::NestedNameSpecifier::SpecifierKind

Fixes in this iteration include:

  (1) Compute the type-source range properly for a dependent template
  specialization type that starts with "template template-id ::", as
  in a member access expression

    dep->template f<T>::f()

  This is a latent bug I triggered with this change (because now we're
  checking the computed source ranges for dependent template
  specialization types). But the real problem was...

  (2) Make sure to set the qualifier range on a dependent template
  specialization type appropriately. This will go away once we push
  nested-name-specifier locations into dependent template
  specialization types, but it was the source of the
  valgrind errors on the buildbots.
  

llvm-svn: 126765
2011-03-01 18:12:44 +00:00
Douglas Gregor b3a58b08e0 Revert r126748, my second attempt at nested-name-specifier source
location information for elaborated types. *sigh*

llvm-svn: 126753
2011-03-01 17:25:47 +00:00
Douglas Gregor bf5fe47b12 Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.

The commit message from r126737:

Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.

llvm-svn: 126748
2011-03-01 16:31:39 +00:00
Douglas Gregor 62a60c50f4 Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.
llvm-svn: 126746
2011-03-01 15:34:37 +00:00
Douglas Gregor 9720642c68 Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.

llvm-svn: 126737
2011-03-01 03:11:17 +00:00
Douglas Gregor 3d0da5f5dd Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.

Also, teach libclang about TypedefDecl source ranges, so that we get
those. The massive churn in test/Index/recursive-cxx-member-calls.cpp
is a good thing: we're annotating a lot more of this test correctly
now.

llvm-svn: 126729
2011-03-01 01:34:45 +00:00
Douglas Gregor 9cbc22ba2d Teach Sema::CheckTypenameType to use nested-name-specifiers with
source-location information. We don't actually preserve this
information in any of the resulting TypeLocs (yet), so it doesn't
matter.

llvm-svn: 126693
2011-02-28 22:42:13 +00:00
Douglas Gregor ea972d3faa Push nested-name-specifier location information into DeclRefExpr and
MemberExpr, the last of the expressions with qualifiers!

llvm-svn: 126688
2011-02-28 21:54:11 +00:00
Douglas Gregor 0da1d43e16 Push nested-name-specifier source location information into
UnresolvedLookupExpr and UnresolvedMemberExpr.

Also, improve the computation that checks whether the base of a member
expression (either unresolved or dependent-scoped) is implicit. The
previous check didn't cover all of the cases we use in our
representation, which threw off source-location information for these
expressions (which, in turn, caused some breakage in libclang's token
annotation). 

llvm-svn: 126681
2011-02-28 20:01:57 +00:00
Douglas Gregor e16af53619 Push nested-name-specifier source location information into
CXXDependentScopeMemberExpr, and clean up instantiation of
nested-name-specifiers with dependent template specialization types in
the process.

llvm-svn: 126663
2011-02-28 18:50:33 +00:00
Douglas Gregor 5a064725d6 Eliminate the last remains of TemplateSpecializationTypes with
dependent template names. There is still a lot of redundant code in
TreeTransform to cope with TemplateSpecializationTypes, which I'll
remove in stages.

llvm-svn: 126656
2011-02-28 17:23:35 +00:00
Douglas Gregor 6e068014f0 When we encounter a dependent template name within a
nested-name-specifier, e.g., 

  T::template apply<U>::

represent the dependent template name specialization as a
DependentTemplateSpecializationType, rather than a
TemplateSpecializationType with a dependent TemplateName.

llvm-svn: 126593
2011-02-28 00:04:36 +00:00
Douglas Gregor 3a43fd645d Push nested-name-specifier source location information into
DependentScopeDeclRefExpr. Plus, give NestedNameSpecifierLoc == and !=
operators, since we're going to need 'em elsewhere.

llvm-svn: 126508
2011-02-25 20:49:16 +00:00
Douglas Gregor a6ce608b97 Push nested-name-specifier source-location information into
pseudo-destructor expressions. Also, clean up some
template-instantiation and type-checking issues with
pseudo-destructors.

llvm-svn: 126498
2011-02-25 18:19:59 +00:00
Douglas Gregor 144548072d Use NestedNameSpecifierLoc within out-of-line variables, function, and
tag definitions. Also, add support for template instantiation of
NestedNameSpecifierLocs.

llvm-svn: 126470
2011-02-25 02:25:35 +00:00
Douglas Gregor 869ad45f8f Retain complete source-location information for C++
nested-name-specifiers throughout the parser, and provide a new class
(NestedNameSpecifierLoc) that contains a nested-name-specifier along
with its type-source information.

Right now, this information is completely useless, because we don't
actually store the source-location information anywhere in the
AST. Call this Step 1/N.

llvm-svn: 126391
2011-02-24 17:54:50 +00:00
Douglas Gregor 7b26ff912f Teach NestedNameSpecifier to keep track of namespace aliases the same
way it keeps track of namespaces. Previously, we would map from the
namespace alias to its underlying namespace when building a
nested-name-specifier, losing source information in the process.

llvm-svn: 126358
2011-02-24 02:36:08 +00:00
Douglas Gregor 2ab3fee3f3 Tweak the CXXScopeSpec API a bit, so that we require the
nested-name-specifier and source range to be set at the same time.

llvm-svn: 126347
2011-02-24 00:49:34 +00:00
Douglas Gregor 90c9972fb2 Teach CXXScopeSpec to handle the extension of a nested-name-specifier
with another component in the nested-name-specifiers, updating its
representation (a NestedNameSpecifier) and source-location information
(currently a SourceRange) simultaneously. This is groundwork for
adding source-location information to nested-name-specifiers.

llvm-svn: 126346
2011-02-24 00:17:56 +00:00
Richard Smith 2abf6767e3 Fix PR9276: We were missing the checks for auto deducing to different types in the same declaration group in the template instantiation case.
llvm-svn: 126279
2011-02-23 00:37:57 +00:00
Richard Smith 30482bc786 Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.

llvm-svn: 126069
2011-02-20 03:19:35 +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 c07a0c7e48 Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr.  This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait;  or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here.  In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some          
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.

llvm-svn: 125744
2011-02-17 10:25:35 +00:00
Chris Lattner c8e630e4db Step #1/N of implementing support for __label__: split labels into
LabelDecl and LabelStmt.  There is a 1-1 correspondence between the
two, but this simplifies a bunch of code by itself.  This is because
labels are the only place where we previously had references to random
other statements, causing grief for AST serialization and other stuff.

This does cause one regression (attr(unused) doesn't silence unused
label warnings) which I'll address next.

This does fix some minor bugs:
1. "The only valid attribute " diagnostic was capitalized.
2. Various diagnostics printed as ''labelname'' instead of 'labelname'
3. This reduces duplication of label checking between functions and blocks.

Review appreciated, particularly for the cindex and template bits.

llvm-svn: 125733
2011-02-17 07:39:24 +00:00
Peter Collingbourne 41f8546233 AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actions
llvm-svn: 125217
2011-02-09 21:07:24 +00:00
John McCall bd06678921 Remove vtables from the Stmt hierarchy; this was pretty easy as
there were only three virtual methods of any significance.

The primary way to grab child iterators now is with
  Stmt::child_range children();
  Stmt::const_child_range children() const;
where a child_range is just a std::pair of iterators suitable for
being llvm::tie'd to some locals.  I've left the old child_begin()
and child_end() accessors in place, but it's probably a substantial
penalty to grab the iterators individually now, since the
switch-based dispatch is kindof inherently slower than vtable
dispatch.  Grabbing them together is probably a slight win over the
status quo, although of course we could've achieved that with vtables, too.

I also reclassified SwitchCase (correctly) as an abstract Stmt
class, which (as the first such class that wasn't an Expr subclass)
required some fiddling in a few places.

There are somewhat gross metaprogramming hooks in place to ensure
that new statements/expressions continue to implement
getSourceRange() and children().  I had to work around a recent clang
bug;  dgregor actually fixed it already, but I didn't want to
introduce a selfhosting dependency on ToT.

llvm-svn: 125183
2011-02-09 08:16:59 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
John McCall 490112f7bf Assert during instantiation of blocks that we've captured everything that
we captured in the dependent case.

llvm-svn: 124887
2011-02-04 18:33:18 +00:00
Douglas Gregor db9d664244 Rvalue references for *this:
- Add ref-qualifiers to the type system; they are part of the
  canonical type. Print & profile ref-qualifiers
  - Translate the ref-qualifier from the Declarator chunk for
    functions to the function type. 
  - Diagnose mis-uses of ref-qualifiers w.r.t. static member
  functions, free functions, constructors, destructors, etc.
  - Add serialization and deserialization of ref-qualifiers.

llvm-svn: 124281
2011-01-26 05:01:58 +00:00
Douglas Gregor 2d525f08c2 Teach TemplateSpecializationTypeLoc::initializeArgLocs() to actually
generate meaningful [*] template argument location information.

[*] Well, as meaningful as possible, given that this entire code path
is a hack for when we've lost type-source information.

llvm-svn: 124211
2011-01-25 19:13:18 +00:00
Douglas Gregor a518d5b3ac Be a bit more defensive about setting the temporary base location
during template instantiation. This code needs to eventually die, but
this little tweak fixes PR8629, where bad location information slipped
through to the location of a class template instantiation.

llvm-svn: 124199
2011-01-25 17:51:48 +00:00
Nick Lewycky 0c4380856b Enhance the diagnostic for referring to a typedef with an elaborated name to be
as useful in a templated context as it is without templates. Fixes PR8755!

llvm-svn: 124136
2011-01-24 19:01:04 +00:00
Douglas Gregor 476e3029ec Implement basic support for the use of variadic templates and blocks
together. In particular: 
  - Handle the use of captured parameter pack names within blocks
  (BlockDeclRefExpr understands parameter packs now)
  - Handle the declaration and expansion of parameter packs within a block's
  parameter list, e.g., ^(Args ...args) { ... })
  - Handle instantiation of blocks where the return type was not
  explicitly specified. (unrelated, but necessary for my tests).

Together, these fixes should make blocks and variadic templates work
reasonably well together. Note that BlockDeclRefExpr is still broken
w.r.t. its computation of type and value dependence, which will still
cause problems for blocks in templates.

llvm-svn: 123849
2011-01-19 21:32:01 +00:00
John McCall 33ddac05bb Change the canonical representation of array types to store qualifiers on the
outermost array types and not on the element type.  Move the CanonicalType
member from Type to ExtQualsTypeCommonBase;  the canonical type on an ExtQuals
node includes the qualifiers on the ExtQuals.  Assorted optimizations enabled
by this change.

getQualifiers(), hasQualifiers(), etc. should all now implicitly look through
array types.

llvm-svn: 123817
2011-01-19 10:06:00 +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
Jeffrey Yasskin 8dfa5f1776 Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.

llvm-svn: 123719
2011-01-18 02:00:16 +00:00
Douglas Gregor 5590be0491 Introduce a new kind of TemplateName that captures a substituted
template template parameter pack that cannot be fully expanded because
its enclosing pack expansion could not be expanded. This form of
TemplateName plays the same role as SubstTemplateTypeParmPackType and
SubstNonTypeTemplateParmPackExpr do for template type parameter packs
and non-type template parameter packs, respectively.

We should now handle these multi-level pack expansion substitutions
anywhere. The largest remaining gap in our variadic-templates support
is that we cannot cope with non-type template parameter packs whose
type is a pack expansion.

llvm-svn: 123521
2011-01-15 06:45:20 +00:00
Douglas Gregor cdbc539aee Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.

llvm-svn: 123506
2011-01-15 01:15:58 +00:00
Douglas Gregor e1d60df0fc Teach template template argument pack expansions to keep track of the
number of expansions, when we know it, and propagate that information
through Sema.

llvm-svn: 123493
2011-01-14 23:41:42 +00:00
Douglas Gregor 715e461463 Handle substitutions into function parameter packs whose patterns
contain multiple parameter packs at different levels.

llvm-svn: 123488
2011-01-14 22:40:04 +00:00
Douglas Gregor b884000ba9 Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema.

llvm-svn: 123470
2011-01-14 21:20:45 +00:00
Douglas Gregor 0dca5fdb4e Keep track of the number of expansions to be produced from a type pack
expansion, when it is known due to the substitution of an out
parameter pack. This allows us to properly handle substitution into
pack expansions that involve multiple parameter packs at different
template parameter levels, even when this substitution happens one
level at a time (as with partial specializations of member class
templates and the signatures of member function templates).

Note that the diagnostic we provide when there is an arity mismatch
between an outer parameter pack and an inner parameter pack in this
case isn't as clear as the normal diagnostic for an arity
mismatch. However, this doesn't matter because these cases are very,
very rare and (even then) only typically occur in a SFINAE context.

The other kinds of pack expansions (expression, template, etc.) still
need to support optional tracking of the number of expansions, and we
need the moral equivalent of SubstTemplateTypeParmPackType for
substituted argument packs of template template and non-type template
parameters.

llvm-svn: 123448
2011-01-14 17:04:44 +00:00
Douglas Gregor ada4b79947 Start implementing support for substitution into pack expansions that
involve template parameter packs at multiple template levels that
occur within the signatures members of class templates (and partial
specializations thereof). This is a work-in-progress that is deficient
in several ways, notably:
  - It only works for template type parameter packs, but we need to
  also support non-type template parameter packs and template template
  parameter packs.
  - It doesn't keep track of the lengths of the substituted argument
  packs in the expansion, so it can't properly diagnose length
  mismatches.

However, this is a concrete step in the right direction.

llvm-svn: 123425
2011-01-14 02:55:32 +00:00
Douglas Gregor 0f836ea213 Allow us to transform pack expansion expressions.
llvm-svn: 123349
2011-01-13 00:19:55 +00:00
Douglas Gregor 822d030118 Teach TreeTransform how to transform a pack expansion type into
another pack expansion type. This can happen when rebuilding types in
the current instantiation.

Fixes <rdar://problem/8848837> (Clang crashing on libc++ <functional>).

llvm-svn: 123316
2011-01-12 17:07:58 +00:00
Douglas Gregor 2fcb863b2b Implement partial ordering of class template partial specializations
and function templates that contain variadic templates. This involves
three small-ish changes:

  (1) When transforming a pack expansion, if the transformed argument
  still contains unexpanded parameter packs, build a pack
  expansion. This can happen during the substitution that occurs into
  class template partial specialiation template arguments during
  partial ordering. 
 
  (2) When performing template argument deduction where the argument
  is a pack expansion, match against the pattern of that pack
  expansion.

  (3) When performing template argument deduction against a non-pack
  parameter, or a non-expansion template argument, deduction fails if
  the argument itself is a pack expansion (C++0x
  [temp.deduct.type]p22).

llvm-svn: 123279
2011-01-11 22:21:24 +00:00
Douglas Gregor 48d2411597 Implement more of C++0x [temp.arg.explicit]p9, allowing extension of
pack expansions in template argument lists and function parameter
lists. The implementation of this paragraph should be complete
*except* for cases where we're substituting into one of the unexpanded
packs in a pack expansion; that's a general issue I haven't solved yet.

llvm-svn: 123188
2011-01-10 20:53:55 +00:00
Douglas Gregor a8bac7f514 Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
allows an argument pack determines via explicit specification of
function template arguments to be extended by further, deduced
arguments. For example:

template<class ... Types> void f(Types ... values);
void g() { 
  f<int*, float*>(0, 0, 0);   // Types is deduced to the sequence int*, float*, int
}

There are a number of FIXMEs in here that indicate places where we
need to implement + test retained expansions, plus a number of other
places in deduction where we need to correctly cope with the
explicitly-specified arguments when deducing an argument
pack. Furthermore, it appears that the RecursiveASTVisitor needs to be
auditied; it's missing some traversals (especially w.r.t. template
arguments) that cause it not to find unexpanded parameter packs when
it should.

The good news, however, is that the tr1::tuple implementation now
works fully, and the tr1::bind example (both from N2080) is actually
working now. 

llvm-svn: 123163
2011-01-10 07:32:04 +00:00
Douglas Gregor 9f627df2f2 Fix a valgrind error when transforming function prototypes with
function parameter pack expansions.

llvm-svn: 123007
2011-01-07 19:27:47 +00:00
Douglas Gregor f30101186f Implement substitution of a function parameter pack for its set of
instantiated function parameters, enabling instantiation of arbitrary
pack expansions involving function parameter packs. At this point, we
can now correctly compile a simple, variadic print() example:

  #include <iostream>
  #include <string>

  void print() {}

  template<typename Head, typename ...Tail>
  void print(const Head &head, const Tail &...tail) {
    std::cout << head;
    print(tail...);
  }

  int main() {
    std::string hello = "Hello";
    print(hello, ", world!", " ", 2011, '\n');
  }

llvm-svn: 123000
2011-01-07 16:43:16 +00:00
Douglas Gregor dd47216cc4 Factor out the template transformation of a sequence of function
parameters into parameter types, so that substitution of
explicitly-specified function template arguments uses the same
path. This enables the use of explicitly-specified function template
arguments with variadic templates.

llvm-svn: 122986
2011-01-07 00:20:55 +00:00
John McCall 8190451ddc Introduce an AttributedType, but don't actually use it anywhere yet.
The initial TreeTransform is a cop-out, but it's more-or-less equivalent
to what we were doing before, or rather what we're doing now and might
eventually stop doing in favor of using this type.
I am simultaneously intrigued by the possibilities of rebuilding a
dependent Attri

llvm-svn: 122942
2011-01-06 01:58:22 +00:00
Douglas Gregor f6272cd7e9 Eliminate an unnecessary dance where we tried to cope with the lack of
TypeSourceInfo when transforming a function parameter. The callees of
this routine already assume that TypeSourceInfo will be present, and
we want to always be sure that it exists.

llvm-svn: 122927
2011-01-05 23:16:57 +00:00
Douglas Gregor 5499af4ef9 Initial implementation of function parameter packs. This implementation allows:
1) Declaration of function parameter packs
  2) Instantiation of function parameter packs within function types.
  3) Template argument deduction of function parameter packs when
  matching two function types.

We're missing all of the important template-instantiation logic for
function template definitions, along with template argument deduction
from the argument list of a function call, so don't even think of
trying to use these for real yet.

llvm-svn: 122926
2011-01-05 23:12:31 +00:00
Douglas Gregor 79aaca42ac Eliminate two "unsupported" errors relating to variadic templates: one
for template template argument pack expansions (which was no longer
used) and another that was a placeholder for an llvm_unreachable.

llvm-svn: 122898
2011-01-05 19:06:29 +00:00
Douglas Gregor e4ff4b56fe Replace the representation of template template argument pack
expansions with something that is easier to use correctly: a new
template argment kind, rather than a bit on an existing kind. Update
all of the switch statements that deal with template arguments, fixing
a few latent bugs in the process. I"m happy with this representation,
now.

And, oh look! Template instantiation and deduction work for template
template argument pack expansions.

llvm-svn: 122896
2011-01-05 18:58:31 +00:00
John McCall 3882ace207 Refactor the application of type attributes so that attributes from
the declaration-specifiers and on the declarator itself are moved
to the appropriate declarator chunk.  This permits a greatly
simplified model for how to apply these attributes, as well as
allowing a much more efficient query for the GC attribute.
Now all qualifier queries follow the same basic strategy of
"local qualifiers, local qualifiers on the canonical type,
then look through arrays".  This can be easily optimized by
changing the canonical qualified-array-type representation.

Do not process type attributes as decl attributes on declarations
with declarators.

When computing the type of a block, synthesize a prototype
function declarator chunk if the decl-spec type was not a
function.  This simplifies the logic for building block signatures.

Change the logic which inserts an objc_read_weak on a block
literal to only fire if the block has a __weak __block variable,
rather than if the return type of the block is __weak qualified,
which is not actually a sensible thing to ask.

llvm-svn: 122871
2011-01-05 12:14:39 +00:00
Douglas Gregor 820ba7ba43 Implement the sizeof...(pack) expression to compute the length of a
parameter pack.

Note that we're missing proper libclang support for the new
SizeOfPackExpr expression node.

llvm-svn: 122813
2011-01-04 17:33:58 +00:00
Douglas Gregor 98318c2259 Properly rebuild pack expansions whose pattern is a non-type template
argument. As part of this, be more careful when determining if there
are any parameter packs that cannot be expanded.

llvm-svn: 122776
2011-01-03 21:37:45 +00:00
Douglas Gregor 968f23ab97 Implement support for pack expansions in initializer lists and
expression lists.

llvm-svn: 122764
2011-01-03 19:31:53 +00:00
Douglas Gregor a3efea1881 Refactor the tree transform's many loops over sets of expressions
(transforming each in turn) into calls into one central routine
(TransformExprs) that transforms a list of expressions. This
refactoring is preparatory work for pack expansions whose in an
expression-list. 

No functionality change.

llvm-svn: 122761
2011-01-03 19:04:46 +00:00
Douglas Gregor e8e9dd624c Implement support for pack expansions whose pattern is a non-type
template argument (described by an expression, of course). For
example:

  template<int...> struct int_tuple { };

  template<int ...Values>
  struct square {
    typedef int_tuple<(Values*Values)...> type;
  };

It also lays the foundation for pack expansions in an initializer-list.
  

llvm-svn: 122751
2011-01-03 17:17:50 +00:00
Douglas Gregor 5c7aa98886 Add some const qualifiers
llvm-svn: 122365
2010-12-21 21:51:48 +00:00
Douglas Gregor 76aca7b2e8 Implement instantiation of pack expansions whose pattern is a type-id
in an exception specification.

llvm-svn: 122297
2010-12-21 00:52:54 +00:00
Douglas Gregor fe921a79f3 Further refactoring of the tree transformation for template argument
lists, so that all such transformations go through a single,
iterator-based transformation function. This is the only place where
we need to implement the logic for transforming pack expansions whose
pattern is a template argument.

Unfortunately, the new cases this refactoring brings into the fold
can't be meaningfully tested yet. We need template argument deduction
to work well enough for variadic function templates first.

llvm-svn: 122289
2010-12-20 23:36:19 +00:00
Douglas Gregor 840bd6cce5 Implement basic support for template instantiation of pack expansions
whose patterns are template arguments. We can now instantiate, e.g.,

  typedef tuple<pair<OuterTypes, InnerTypes>...> type;

where OuterTypes and InnerTypes are template type parameter packs.

There is a horrible inefficiency in
TemplateArgumentLoc::getPackExpansionPattern(), where we need to
create copies of TypeLoc data because our interfaces traffic in
TypeSourceInfo pointers where they should traffic in TypeLocs
instead. I've isolated in efficiency in this one routine; once we
refactor our interfaces to traffic in TypeLocs, we can eliminate it.

llvm-svn: 122278
2010-12-20 22:05:00 +00:00
Matt Beaumont-Gay 8e37ea1a29 Remove unused variable
llvm-svn: 122257
2010-12-20 19:38:37 +00:00
Douglas Gregor 42cafa8dac Finish refactoring the transformation of template argument lists,
centralizing the transformation into two routines. No functionality change.

llvm-svn: 122253
2010-12-20 17:42:22 +00:00
Douglas Gregor 62e06f23ba Refactor the transformation of template argument lists to centralize
the list traversal. Part 1, no functionality change.

llvm-svn: 122252
2010-12-20 17:31:10 +00:00
Douglas Gregor d2fa766ad0 Introduce a new type, PackExpansionType, to capture types that are
pack expansions, e.g. given

  template<typename... Types> struct tuple;

  template<typename... Types>
  struct tuple_of_refs {
    typedef tuple<Types&...> types;
  };

the type of the "types" typedef is a PackExpansionType whose pattern
is Types&. 

This commit introduces support for creating pack expansions for
template type arguments, as above, but not for any other kind of pack
expansion, nor for any form of instantiation.

llvm-svn: 122223
2010-12-20 02:24:11 +00:00
Argyrios Kyrtzidis d0039e56f2 Keep the source location of the selector in ObjCMessageExpr.
llvm-svn: 121516
2010-12-10 20:08:27 +00:00
Abramo Bagnara 924a8f3573 Added ParenType type node.
llvm-svn: 121488
2010-12-10 16:29:40 +00:00
Francois Pichet 34b2113250 Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.
llvm-svn: 121298
2010-12-08 22:35:30 +00:00
Francois Pichet 9dfa3ce94f Type traits intrinsic implementation: __is_base_of(T, U)
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics.

llvm-svn: 121074
2010-12-07 00:08:36 +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
John McCall b7bd14fa08 Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.

llvm-svn: 120643
2010-12-02 01:19:52 +00:00
Douglas Gregor 451d1b1d27 Make TypeLocBuilder an implementation detail of Sema. Nobody else should be using it
llvm-svn: 120628
2010-12-02 00:05:49 +00:00
Argyrios Kyrtzidis de2bdf637e Revert r119838 "Don't warn for empty 'if' body if there is a macro that expands to nothing"
and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro.

Thanks to Abramo Bagnara for the hint!

llvm-svn: 119887
2010-11-20 02:04:01 +00:00
Argyrios Kyrtzidis 90ee2a4ecf Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:
if (condition)
    CALL(0); // empty macro but don't warn for empty body.

Fixes rdar://8436021.

llvm-svn: 119838
2010-11-19 20:54:25 +00:00
John McCall 7decc9e4ea Calculate the value kind of an expression when it's created and
store it on the expression node.  Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.

llvm-svn: 119685
2010-11-18 06:31:45 +00:00
John McCall 8d69a2160e Add a new expression kind, OpaqueValueExpr, which is useful for
certain internal type-checking procedures as well as for representing
certain implicitly-generated operations.  Uses to follow.

llvm-svn: 119289
2010-11-15 23:31:06 +00:00
John McCall 31f82720d0 Replace one hack with a different hack: strip out the ObjectType
parameters to the Transform*Type functions and instead call out
the specific cases where an object type and the unqualified lookup
results are important.  Fixes an assert and failed compile on
a testcase from PR7248.

llvm-svn: 118887
2010-11-12 08:19:04 +00:00
Bob Wilson aeb56444f9 Add a variant of GCC-style vector types for ARM NEON.
NEON vector types need to be mangled in a special way to comply with ARM's ABI,
similar to some of the AltiVec-specific vector types.  This patch is mostly
just renaming a bunch of "AltiVecSpecific" things, since they will no longer
be specific to AltiVec.  Besides that, it just adds the new "NeonVector" enum.

llvm-svn: 118724
2010-11-10 21:56:12 +00:00
Douglas Gregor 1ccc8416a0 Remove broken support for variadic templates, along with the various
abstractions (e.g., TemplateArgumentListBuilder) that were designed to
support variadic templates. Only a few remnants of variadic templates
remain, in the parser (parsing template type parameter packs), AST
(template type parameter pack bits and TemplateArgument::Pack), and
Sema; these are expected to be used in a future implementation of
variadic templates.

But don't get too excited about that happening now.

llvm-svn: 118385
2010-11-07 23:05:16 +00:00
John McCall 954b5de0d8 Use the real keyword location when rebuilding an elaborated type instead of
making something up.  Fixes PR8129.

llvm-svn: 118258
2010-11-04 19:04:38 +00:00
John McCall c3007a2145 No really, we don't have a retain/release system for statements/expressions
anymore.

llvm-svn: 117357
2010-10-26 07:05:15 +00:00
Chandler Carruth 0171815ae1 Improve the tracking of source locations for parentheses in constructor calls.
This adds them where missing, and traces them through PCH. We fix at least one
bug in the extents found by the Index library, and make a lot of refactoring
tools which care about the exact formulation of a constructor call easier to
write. Also some minor cleanups to more consistently follow the friend pattern
instead of the setter pattern when rebuilding a serialized AST.

Patch originally by Samuel Benzaquen.

llvm-svn: 117254
2010-10-25 08:47:36 +00:00
Fariborz Jahanian 681c0754d9 Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788

llvm-svn: 116483
2010-10-14 16:04:05 +00:00
John McCall 36e7fe31d4 Add some infrastructure for dealing with expressions of 'placeholder' type,
i.e. expressions with an internally-convenient type which should not be
appearing in generally valid, complete ASTs.

llvm-svn: 116281
2010-10-12 00:20:44 +00:00
John McCall 09d1369964 When instantiating a new-expression, force a rebuild if there were default
arguments in either the placement or constructor arguments.  This is
important if the default arguments refer to a declaration or create a
temporary.

llvm-svn: 115700
2010-10-05 22:36:42 +00:00
Douglas Gregor 7fb25418ed Implement the C++0x "trailing return type" feature, e.g.,
auto f(int) -> int

from Daniel Wallin!

(With a few minor bug fixes from me).

llvm-svn: 115322
2010-10-01 18:44:50 +00:00
Argyrios Kyrtzidis 9f48354b71 Don't warn for an unused label if it has 'unused' attribute. Fixes rdar://8483139.
llvm-svn: 114954
2010-09-28 14:54:07 +00:00
Douglas Gregor 6ed2feebfc When marking the declarations in a default argument expression as
"used", at the time that the default argument itself is used, also
mark destructors that will be called by this expression. This fixes a
regression that I introduced in r113700, which broke WebKit, and fixes
<rdar://problem/8427926>.

llvm-svn: 113883
2010-09-14 22:55:20 +00:00
Sebastian Redl 4202c0f2a9 Define and implement CXXNoexceptExpr. Create it in Sema.
llvm-svn: 113623
2010-09-10 20:55:43 +00:00
Douglas Gregor 9f0e1aa0f2 Simplify template instantiation for C++ exception declarations,
eliminating an unnecessary use of TemporaryBase in the process.

llvm-svn: 113500
2010-09-09 17:09:21 +00:00
Douglas Gregor 3b29b2c795 Eliminate some unnecessary uses of TreeTransform::TemporaryBase. There
are still a few (legitimate, unfortunate) uses of this hack around,
but at least now there are fewer.

llvm-svn: 113498
2010-09-09 16:55:46 +00:00
Douglas Gregor ce5aa33385 Eliminate the comma locations from all of the Sema routines that deal
with comma-separated lists. We never actually used the comma
locations, nor did we store them in the AST, but we did manage to
waste time during template instantiation to produce fake locations.

llvm-svn: 113495
2010-09-09 16:33:13 +00:00
Douglas Gregor 54e5b13a27 Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.

llvm-svn: 113492
2010-09-09 16:14:44 +00:00
Douglas Gregor a5614c5fe8 Push the range associated with a nested-name-specifier further through
TreeTransform, since we were getting an empty source range where we
shouldn't. Sadly, the test case is Boost.Proto, and isn't worth
reducing.

llvm-svn: 113446
2010-09-08 23:56:00 +00:00
Francois Pichet 9f4f2078d6 Microsoft's __uuidof operator implementation part 1.
llvm-svn: 113356
2010-09-08 12:20:18 +00:00
Douglas Gregor 2b88c115f9 Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.

llvm-svn: 113319
2010-09-08 00:15:04 +00:00
Douglas Gregor 0744ef6371 Improve source-location information for CXXNewExpr, by hanging on to
the TypeSourceInfo for the allocated type. Fixes PR7501.

llvm-svn: 113291
2010-09-07 21:49:58 +00:00
Douglas Gregor 6429f5cf29 Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.

llvm-svn: 112868
2010-09-02 21:50:02 +00:00
Douglas Gregor 4afc236cee When instantiating a function type, instantiate the return type before
instantiating the parameters. In a perfect world, this wouldn't
matter, and compilers are free to instantiate in any order they
want. However, every other compiler seems to instantiate the return
type first, and some code (in this case, Boost.Polygon) depends on
this and SFINAE to avoid instantiating something that shouldn't be
instantiated.

We could fight this battle, and insist that Clang is allowed to do
what it does, but it's not beneficial: it's more predictable to
instantiate this way, in source order. When we implement
late-specified return types, we'll need to instantiate the return type
last when it was late-specified, hence the FIXME.

We now compile Boost.Polygon properly.

llvm-svn: 112561
2010-08-31 00:26:14 +00:00
Alexis Hunt 3b7918625c Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

llvm-svn: 112493
2010-08-30 17:47:05 +00:00
Alexis Hunt 79eb5469e0 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

llvm-svn: 112458
2010-08-29 21:26:48 +00:00
Argyrios Kyrtzidis 43b205796f Fix the memory leak of FloatingLiteral/IntegerLiteral.
For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers.
Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
the APFloat/APInt values will never get freed.
I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral.

Fixes rdar://7637185

llvm-svn: 112361
2010-08-28 09:06:06 +00:00
John McCall 1ababa63de Continue to instantiate sub-statements in a CompoundStmt as long as
we don't see a DeclStmt (failure to instantiate which generally causes
panic).

llvm-svn: 112282
2010-08-27 19:56:05 +00:00
John McCall faf5fb4b78 One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.

llvm-svn: 112244
2010-08-26 23:41:50 +00:00
John McCall 8302463dc6 Split out a header to hold APIs meant for the Sema implementation from Sema.h.
Clients of Sema don't need to know (for example) the list of diagnostics we
support.

llvm-svn: 112093
2010-08-25 22:03:47 +00:00
John McCall e302792b61 GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.

llvm-svn: 112047
2010-08-25 11:45:40 +00:00
John McCall aab3e41eb2 Split FunctionScopeInfo and BlockScopeInfo into their own header.
llvm-svn: 112038
2010-08-25 08:40:02 +00:00