History log of /external/clang/include/clang/AST/ExprCXX.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
3d9efecfb174a99ffd1f7a6156f7de3ca855993f 28-Sep-2013 James Dennett <jdennett@google.com> Documentation: minor fixes/improvements to documentation of DependentScopeDeclRefExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191622 91177308-0d34-0410-b5e6-96231b3b80d8
04fa7a33279808dc3e5117c41b5f84c40eeb7362 28-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Per latest drafting, switch to implementing init-captures as if by declaring
and capturing a variable declaration, and complete the implementation of them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191605 91177308-0d34-0410-b5e6-96231b3b80d8
fe16aa31fdfaad4c38aed443d853af293714f1c4 27-Sep-2013 David Majnemer <david.majnemer@gmail.com> AST: Handle qualified array types in typeid() expressions

The intent of getTypeOperand() was to yield an unqualified type.
However QualType::getUnqualifiedType() does not strip away qualifiers on

N.B. This worked fine when typeid() was applied to an expression
because we would inject as implicit cast to the unqualified array type
in the AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191487 91177308-0d34-0410-b5e6-96231b3b80d8
fad9e13f3cb85198f0ee5af620ba81cd78574faa 26-Sep-2013 Faisal Vali <faisalv@yahoo.com> Implement a rudimentary form of generic lambdas.

Specifically, the following features are not included in this commit:
- any sort of capturing within generic lambdas
- generic lambdas within template functions and nested
within other generic lambdas
- conversion operator for captureless lambdas
- ensuring all visitors are generic lambda aware
(Although I have gotten some useful feedback on my patches of the above and will be incorporating that as I submit those patches for commit)

As an example of what compiles through this commit:

template <class F1, class F2>
struct overload : F1, F2 {
using F1::operator();
using F2::operator();
overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }

auto Recursive = [](auto Self, auto h, auto ... rest) {
return 1 + Self(Self, rest...);
auto Base = [](auto Self, auto h) {
return 1;
overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

This patch has been reviewed by Doug and Richard. Minor changes (non-functionality affecting) have been made since both of them formally looked at it, but the changes involve removal of supernumerary return type deduction changes (since they are now redundant, with richard having committed a recent patch to address return type deduction for C++11 lambdas using C++14 semantics).

Some implementation notes:

- Add a new Declarator context => LambdaExprParameterContext to
clang::Declarator to allow the use of 'auto' in declaring generic
lambda parameters

- Add various helpers to CXXRecordDecl to facilitate identifying
and querying a closure class

- LambdaScopeInfo (which maintains the current lambda's Sema state)
was augmented to house the current depth of the template being
parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
so that SemaType.cpp::ConvertDeclSpecToType may use it to immediately
generate a template-parameter-type when 'auto' is parsed in a generic
lambda parameter context. (i.e we do NOT use AutoType deduced to
a template parameter type - Richard seemed ok with this approach).
We encode that this template type was generated from an auto by simply
adding $auto to the name which can be used for better diagnostics if needed.

- SemaLambda.h was added to hold some common lambda utility
functions (this file is likely to grow ...)

- Teach Sema::ActOnStartOfFunctionDef to check whether it
is being called to instantiate a generic lambda's call
operator, and if so, push an appropriately prepared
LambdaScopeInfo object on the stack.

- various tests were added - but much more will be needed.

There is obviously more work to be done, and both Richard (weakly) and Doug (strongly)
have requested that LambdaExpr be removed form the CXXRecordDecl LambdaDefinitionaData
in a future patch which is forthcoming.

A greatful thanks to all reviewers including Eli Friedman, James Dennett,
and especially the two gracious wizards (Richard Smith and Doug Gregor)
who spent hours providing feedback (in person in Chicago and on the mailing lists).
And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191453 91177308-0d34-0410-b5e6-96231b3b80d8
29b37a06fc58bb2993d1c35cf7411b6b94b1116a 07-Sep-2013 David Majnemer <david.majnemer@gmail.com> AST: __uuidof should leak through templated types

__uuidof on templated types should exmaine if any of its template
parameters have a uuid declspec. If exactly one does, then take it.
Otherwise, issue an appropriate error.

Reviewers: rsmith, thakis, rnk

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190240 91177308-0d34-0410-b5e6-96231b3b80d8
1245a54ca6e9c5b14196461dc3f84b24ea6594b1 07-Sep-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fix missing source location in CXXTemporaryObjectExpr nodes.
For clarity, renamed (get/set)ParenRange as (get/set)ParenOrBraceRange
in CXXConstructExpr nodes.
Added testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190239 91177308-0d34-0410-b5e6-96231b3b80d8
152b4e4652baedfceba1cd8115515629225e713f 22-Aug-2013 Manuel Klimek <klimek@google.com> Revert "Implement a rudimentary form of generic lambdas."

This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189004 91177308-0d34-0410-b5e6-96231b3b80d8
32b5a1e82f535d43e94332183cd330f4a39b2dbd 22-Aug-2013 Craig Topper <craig.topper@gmail.com> Constify more uses of ASTContext&. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188991 91177308-0d34-0410-b5e6-96231b3b80d8
ecb5819a9e64fb654d46a3b270a286cc570c58ff 22-Aug-2013 Faisal Vali <faisalv@yahoo.com> Implement a rudimentary form of generic lambdas.

Specifically, the following features are not included in this commit:
- any sort of capturing within generic lambdas
- nested lambdas
- conversion operator for captureless lambdas
- ensuring all visitors are generic lambda aware

As an example of what compiles:

template <class F1, class F2>
struct overload : F1, F2 {
using F1::operator();
using F2::operator();
overload(F1 f1, F2 f2) : F1(f1), F2(f2) { }

auto Recursive = [](auto Self, auto h, auto ... rest) {
return 1 + Self(Self, rest...);
auto Base = [](auto Self, auto h) {
return 1;
overload<decltype(Base), decltype(Recursive)> O(Base, Recursive);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');

Please see attached tests for more examples.

Some implementation notes:

- Add a new Declarator context => LambdaExprParameterContext to
clang::Declarator to allow the use of 'auto' in declaring generic
lambda parameters

- Augment AutoType's constructor (similar to how variadic
template-type-parameters ala TemplateTypeParmDecl are implemented) to
accept an IsParameterPack to encode a generic lambda parameter pack.

- Add various helpers to CXXRecordDecl to facilitate identifying
and querying a closure class

- LambdaScopeInfo (which maintains the current lambda's Sema state)
was augmented to house the current depth of the template being
parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth)
so that Sema::ActOnLambdaAutoParameter may use it to create the
appropriate list of corresponding TemplateTypeParmDecl for each
auto parameter identified within the generic lambda (also stored
within the current LambdaScopeInfo). Additionally,
a TemplateParameterList data-member was added to hold the invented
TemplateParameterList AST node which will be much more useful
once we teach TreeTransform how to transform generic lambdas.

- SemaLambda.h was added to hold some common lambda utility
functions (this file is likely to grow ...)

- Teach Sema::ActOnStartOfFunctionDef to check whether it
is being called to instantiate a generic lambda's call
operator, and if so, push an appropriately prepared
LambdaScopeInfo object on the stack.

- Teach Sema::ActOnStartOfLambdaDefinition to set the
return type of a lambda without a trailing return type
to 'auto' in C++1y mode, and teach the return type
deduction machinery in SemaStmt.cpp to process either
C++11 and C++14 lambda's correctly depending on the flag.

- various tests were added - but much more will be needed.

A greatful thanks to all reviewers including Eli Friedman,
James Dennett and the ever illuminating Richard Smith. And
yet I am certain that I have allowed unidentified bugs to creep in;
bugs, that I will do my best to slay, once identified!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188977 91177308-0d34-0410-b5e6-96231b3b80d8
cdd4b78583120222b82148626119b3e80ae1d291 16-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Properly track l-paren of a CXXFucntionalCastExpr.

In addition to storing more useful information in the AST, this
fixes a semantic check in template instantiation which checks whether
the l-paren location is valid.

Fixes PR16903.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188495 91177308-0d34-0410-b5e6-96231b3b80d8
c80eb46a0f37bee9597f1b466013a0f6271f9318 13-Aug-2013 David Majnemer <david.majnemer@gmail.com> [-cxx-abi microsoft] Mangle __uuidof correctly into template parameters

It seems that __uuidof introduces a global extern "C" declaration of
type __s_GUID. However, our implementation of __uuidof does not provide
such a declaration and thus must open-code the mangling for __uuidof in
template parameters.

This allows us to codegen scoped COM pointers and other such things.

This fixes PR16836.
Depends on D1356.

Reviewers: rnk, cdavis5x, rsmith

Reviewed By: rnk

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188252 91177308-0d34-0410-b5e6-96231b3b80d8
f68af647dda5cca00b49be27d24f62b0a7fff986 10-Aug-2013 James Dennett <jdennett@google.com> Expose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr.

Source-centric tools need access to the location of a C++11
lambda expression's capture-default ('&' or '=') when it's present.
It's possible for them to find it by re-lexing and re-implementing
rules that Clang's parser has already applied, but the cost of storing
the SourceLocation and making it available to them is 32 bits per
LambdaExpr (a small delta, proportionally), and the simplification in
client code is significant.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits, klimek, revane

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188121 91177308-0d34-0410-b5e6-96231b3b80d8
80747a834cf8b0304b314ede9aba3d6ddb8e9520 08-Jul-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/include/clang/AST/ExprCXX.h:260:5: Fix a warning -- unknown command tag name 'cc'; did you mean 'c'? [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185810 91177308-0d34-0410-b5e6-96231b3b80d8
010bfc253050626435f006386c0bee4b55329687 08-Jul-2013 James Dennett <jdennett@google.com> Documentation cleanup for include/clang/AST/ExprCXX.h.

This is mostly Doxygen formatting, but also updates some C++0x references
to C++11 and clarifies some wording.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185798 91177308-0d34-0410-b5e6-96231b3b80d8
bd9cbd22b832ce65a085801259cf2d3df77830e4 07-Jul-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed source range for functional cast and unresolved construct expr nodes.
Added testcases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185773 91177308-0d34-0410-b5e6-96231b3b80d8
c65f03498f6c59b5ae5c14086f49ae6e7a173624 05-Jul-2013 James Dennett <jdennett@google.com> Add some more documentation on how to navigate from a LambdaExpr::Capture
to the associated FieldDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185674 91177308-0d34-0410-b5e6-96231b3b80d8
ddcd660efccd7dcbe42cf1a5759b37ee5619bf9b 02-Jul-2013 James Dennett <jdennett@google.com> Documentation: Update docs for C++ lambdas to more accurately reflect
C++1y init-capture support, and to improve some Doxygen markup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185469 91177308-0d34-0410-b5e6-96231b3b80d8
7c3e615f01e8f9f587315800fdaf2305ed824568 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
211c8ddb5b500ed84833751363d0cfe1115f4dd3 05-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Model temporary lifetime-extension explicitly in the AST. Use this model to
handle temporaries which have been lifetime-extended to static storage duration
within constant expressions. This correctly handles nested lifetime extension
(through reference members of aggregates in aggregate initializers) but
non-constant-expression emission hasn't yet been updated to do the same.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183283 91177308-0d34-0410-b5e6-96231b3b80d8
16b0a310f5649d25849d84409841f401e7a9a0e5 03-Jun-2013 David Blaikie <dblaikie@gmail.com> UnresolvedMemberExpr should have an expr location of the member (not the base)

This matches the behavior of MemberExpr and makes diagnostics such as
"reference to non-static member function must be called" more legible in
the case that the base & member are split over multiple lines (prior to
this change the diagnostic would point to the base, not the member -
making it very unclear in chained multi-line builder-style calls)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183149 91177308-0d34-0410-b5e6-96231b3b80d8
0d8e9646bc000bab521ce52ed294209a92298cef 16-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8
7247c88d1e41514a41085f83ebf03dd5220e054a 15-May-2013 David Blaikie <dblaikie@gmail.com> Use only explicit bool conversion operator

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
76da55d3a49e1805f51b1ced7c5da5bcd7f759d8 16-Apr-2013 John McCall <rjmccall@apple.com> Basic support for Microsoft property declarations and
references thereto.

Patch by Tong Shen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179585 91177308-0d34-0410-b5e6-96231b3b80d8
f799ae1afb897151a84a7170951e367d8307ae04 22-Feb-2013 Fariborz Jahanian <fjahanian@apple.com> objective-C arg: provide fixit support when
c++'s named cast need be replaced for bridge casting.
// rdar://12788838

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175923 91177308-0d34-0410-b5e6-96231b3b80d8
66874fb18afbffb8b2ca05576851a64534be3352 21-Feb-2013 David Blaikie <dblaikie@gmail.com> Use None rather than Optional<T>() where possible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175705 91177308-0d34-0410-b5e6-96231b3b80d8
dc84cd5efdd3430efb22546b4ac656aa0540b210 20-Feb-2013 David Blaikie <dblaikie@gmail.com> Include llvm::Optional in clang/Basic/LLVM.h

Post-commit CR feedback from Jordan Rose regarding r175594.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175679 91177308-0d34-0410-b5e6-96231b3b80d8
7d9f07732b85f1b2989c640065512a6af9a0f49a 26-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Constify getOptionalExplicitTemplateArgs()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173575 91177308-0d34-0410-b5e6-96231b3b80d8
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
65d78312ce026092cb6e7b1d4d06f05e18d02aa0 25-Dec-2012 Erik Verbruggen <erikjv@me.com> Fix for PR12222.

Changed getLocStart() and getLocEnd() to be required for Stmts, and make
getSourceRange() optional. The default implementation for getSourceRange()
is build the range by calling getLocStart() and getLocEnd().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171067 91177308-0d34-0410-b5e6-96231b3b80d8
c83c2300e1946fea78ecd3c2e93d9c2dd2638a2b 19-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13470: Ensure that copy-list-initialization isntantiates as
copy-list-initialization (and doesn't add an additional copy step):

Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it
when instantiating initializers in order to correctly handle instantiation of
copy-list-initialization. Teach TreeTransform that function arguments are
initializations, and so need this special treatment too. Finally, remove some
hacks which were working around SubstInitializer's shortcomings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170489 91177308-0d34-0410-b5e6-96231b3b80d8
30a2e16f6c27f888dd11eba6bbbae1e980078fcb 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort #include lines for all files under include/...

This is a simpler sort, entirely automatic with the help of
llvm/utils/sort_includes.py -- no manual edits here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169238 91177308-0d34-0410-b5e6-96231b3b80d8
2fa67efeaf66a9332c30a026dc1c21bef6c33a6c 01-Dec-2012 Benjamin Kramer <benny.kra@googlemail.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169092 91177308-0d34-0410-b5e6-96231b3b80d8
63b6ebe4e732f20fa24ea0666ed438dd5004cc20 23-Nov-2012 Benjamin Kramer <benny.kra@googlemail.com> Sema: Provide a valid source location when instantiating templates based on a CXXDefaultArgExpr.

Fixes PR13758.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168521 91177308-0d34-0410-b5e6-96231b3b80d8
d9ffa0c39ff9c71e2729eac4cdcf32b377c1d3b6 18-Nov-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix Doxygen comment start sequence.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168276 91177308-0d34-0410-b5e6-96231b3b80d8
530564196fe7e2e30fbc2b0edae45975447583e0 07-Nov-2012 David Blaikie <dblaikie@gmail.com> PR13552: Fix the end location of a CXXNewExpr.

Spent longer than reasonable looking for a nice way to test this & decided to
give up for now. Open to suggestions/requests. Richard Smith suggested adding
something to ASTMatchers but it wasn't readily apparent how to test this with

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167507 91177308-0d34-0410-b5e6-96231b3b80d8
b1502bcd67fb593a95cbf73ec3814f4015666da0 18-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1442: In a range-based for statement, namespace 'std' is not an associated

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166194 91177308-0d34-0410-b5e6-96231b3b80d8
b43d87b0646aa04951056c7e0d1ab9a58eb09f66 12-Oct-2012 Sean Silva <silvas@purdue.edu> Remove pointless classof()'s.

Updates to llvm/Support/Casting.h have rendered these classof()'s

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165770 91177308-0d34-0410-b5e6-96231b3b80d8
c5f804636e367ef744fd24cf88f7c956a5af0434 11-Oct-2012 Nico Weber <nicolasweber@gmx.de> Add codegen support for __uuidof().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165710 91177308-0d34-0410-b5e6-96231b3b80d8
be9af1288881110e406b87914162eaa59f1e5918 02-Oct-2012 Lang Hames <lhames@gmail.com> Add FP_CONTRACT support for clang.

Clang will now honor the FP_CONTRACT pragma and emit LLVM
fmuladd intrinsics for expressions of the form A * B + C (when they occur in a
single statement).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164989 91177308-0d34-0410-b5e6-96231b3b80d8
9a4db032ecd991626d236a502e770126db32bd31 12-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13811: Add a FunctionParmPackExpr node to handle references to function
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163672 91177308-0d34-0410-b5e6-96231b3b80d8
fb7669ee725ec699e2b49b8359c4652536949739 11-Sep-2012 Douglas Gregor <dgregor@apple.com> Fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163597 91177308-0d34-0410-b5e6-96231b3b80d8
3b6bef9a213249c6ab6d67c07b1ac6380961be3e 24-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Push ArrayRef through the Expr hierarchy.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162552 91177308-0d34-0410-b5e6-96231b3b80d8
88920d1a84dc63a3722b1f2b1fb5926c44bd81ab 23-Aug-2012 Roman Divacky <rdivacky@freebsd.org> Mark these const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162443 91177308-0d34-0410-b5e6-96231b3b80d8
a796b6c4b99116ca31e6e61d8765b321678d580e 21-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Switch some realignment calculations over to llvm::RoundUpToAlignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162297 91177308-0d34-0410-b5e6-96231b3b80d8
88d2f678e70ab9360f09f3534d9223e6ec20f129 21-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix alignment of array of VarDecl* following array of unsigned in LambdaExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162255 91177308-0d34-0410-b5e6-96231b3b80d8
0d729105ecb50a7e3cbe6e57c29149edfa5cf05a 13-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Factor out computation of whether a typeid's expression is potentially
evaluated into a CXXTypeid member function. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161779 91177308-0d34-0410-b5e6-96231b3b80d8
612409ece080e814f79e06772c690d603f45fbd6 25-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12057: Allow variadic template pack expansions to cross lambda boundaries.
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every
AST node, we tunnel the bit directly up to the surrounding lambda expression
when we reach a context where an unexpanded pack can not normally appear.
Thus any statement or declaration within a lambda can now potentially contain
an unexpanded parameter pack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160705 91177308-0d34-0410-b5e6-96231b3b80d8
a770a4daf77037b5526dba1c447d61acf0aba01a 16-Jul-2012 Daniel Jasper <djasper@google.com> Add correct parenthesis range to CXXConstructExprs inside

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160252 91177308-0d34-0410-b5e6-96231b3b80d8
478851c3ed6bd784e7377dffd8e57b200c1b9ba9 04-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Drop the ASTContext.h include from Stmt.h and fix up transitive users.

This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159718 91177308-0d34-0410-b5e6-96231b3b80d8
f977848850a2f8785dc2b37c735afe0cd223b8bb 17-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup:
* For Doxygen, escaped "::std" as "\::std";
* For humans, fixed "namespaecs" to "namespaces".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158634 91177308-0d34-0410-b5e6-96231b3b80d8
fe865f1f35d1b91f42f58f08a1399b961b71b3bc 15-Jun-2012 James Dennett <jdennett@google.com> Documentation fix (cleaning up my own breakage): close <tt> with </tt>,
not with another <tt>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158546 91177308-0d34-0410-b5e6-96231b3b80d8
0982205bade2fb4fc984c27b2ab401e683963b10 15-Jun-2012 James Dennett <jdennett@google.com> Ongoing documentation cleanup: fixed Doxygen markup errors, added \brief
annotations in many places where it involved little change, fixed some
examples and marked code examples with \code...\endcode, and changed a few
nearby mentions of C++0x to refer to C++11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158486 91177308-0d34-0410-b5e6-96231b3b80d8
809d1be9820039b4cf6efa48246a0d70ffa13394 14-Jun-2012 James Dennett <jdennett@google.com> More doxygen/documentation cleanups.

This reduces the number of warnings generated by Doxygen by about 100
(roughly 10%). Issues addressed:
(1) Primarily, backslash-escaped "@foo" and "#bah" in Doxygen comments
when they're not supposed to be Doxygen commands or links, and
similarly for "<baz>" when it's not intended as as HTML tag;
(2) Changed some \t commands (which don't exist) to \c ("to refer to a
word of code", as the Doxygen manual says);
(3) \precondition becomes \pre;
(4) When touching comments, deleted a couple of spurious spaces in them;
(5) Changed some \n and \r to \\n and \\r;
(6) Fixed one tiny typo: #pragms -> #pragma.

This patch touches documentation/comments only.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158422 91177308-0d34-0410-b5e6-96231b3b80d8
0265555a0fec81102bfb3757cfc7f3d90dbbe409 07-May-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed UserDefinedLiteral source locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156298 91177308-0d34-0410-b5e6-96231b3b80d8
0cf3c0eecbff007cea2750c113894b47d9e09f33 03-May-2012 David Blaikie <dblaikie@gmail.com> Correctly constify clang::CXXMemberCallExpr::getRecordDecl()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156074 91177308-0d34-0410-b5e6-96231b3b80d8
4548ca2912e5f2b78a20e50c58d8a1a9c5e9e67c 01-May-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Store the source range of a CXXOperatorCallExpr in the Expr object instead of
calculating it recursively.

boost::assign::tuple_list_of uses the trick of chaining call operator expressions in order to declare a "list of tuples", e.g:
std::vector<tuple> v = boost::assign::tuple_list_of(1, "foo")(2, "bar")(3, "qqq");

Due to CXXOperatorCallExpr calculating its source range recursively we would get
significant slowdowns with a large number of chained call operator expressions and the
potential for stack overflow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155848 91177308-0d34-0410-b5e6-96231b3b80d8
f54486acc1cadf2791c3916ece66fded1e57ba0b 04-Apr-2012 Douglas Gregor <dgregor@apple.com> Move the computation of the lambda mangling information (mangling
number + context) to the point where we initially start defining the
lambda, so that the linkage won't change when that information is made
available. Fixes the assertion in <rdar://problem/11182962>.

Plus, actually mangle the context of lambdas properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154029 91177308-0d34-0410-b5e6-96231b3b80d8
feb1f4a0a71868a271fa284dadfda7a2beeaccff 09-Mar-2012 Matt Beaumont-Gay <matthewbg@google.com> Add a helper to get a CXXConstructExpr from a CXXNewExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152433 91177308-0d34-0410-b5e6-96231b3b80d8
aa49a7d70e58dac2aeb40664ba16d2ea571b8c95 09-Mar-2012 Daniel Dunbar <daniel@zuster.org> [AST/etc] Mark {getSourceRange(),getStartLoc(),getEndLoc()} as LLVM_READONLY.
- The theory here is that we have these functions sprinkled in all over the
place. This should allow the optimizer to at least realize it can still do
load CSE across these calls.
- I blindly marked all instances as such, even though the optimizer can infer
this attribute in some instances (some of the inline ones) as that was easier
and also, when given the choice between thinking and not thinking, I prefer
the latter.

You might think this is mere frivolity, but actually this is good for a .7 -
1.1% speedup on 403.gcc/combine.c, JSC/Interpreter.cpp,

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152426 91177308-0d34-0410-b5e6-96231b3b80d8
9fcce65e7e1307b5b8da9be13e4092d6bb94dc1d 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
d162cf102449d817a35ae6755b102edcf9d4583b 26-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Reorder members to save padding.

There's more potential here, but these Exprs aren't used that often so I don't feel like doing heroic bit packing right now.

-8 bytes on every class changed (x86_64).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151501 91177308-0d34-0410-b5e6-96231b3b80d8
4ca8ac2e61c37ddadf37024af86f3e1019af8532 24-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement a new type trait __is_trivially_constructible(T, Args...)
that provides the behavior of the C++11 library trait
std::is_trivially_constructible<T, Args...>, which can't be
implemented purely as a library.

Since __is_trivially_constructible can have zero or more arguments, I
needed to add Yet Another Type Trait Expression Class, this one
handling arbitrary arguments. The next step will be to migrate
UnaryTypeTrait and BinaryTypeTrait over to this new, more general
TypeTrait class.

Fixes the Clang side of <rdar://problem/10895483> / PR12038.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151352 91177308-0d34-0410-b5e6-96231b3b80d8
76f3f69db1416425070177243e9f390122c553e0 22-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is a
function call (or a comma expression with a function call on its right-hand
side), possibly parenthesized, then the return type is not required to be
complete and a temporary is not bound. Other subexpressions inside a decltype
expression do not get this treatment.

This is implemented by deferring the relevant checks for all calls immediately
within a decltype expression, then, when the expression is fully-parsed,
checking the relevant constraints and stripping off any top-level temporary

Deferring the completion of the return type exposed a bug in overload
resolution where completion of the argument types was not attempted, which
is also fixed by this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151117 91177308-0d34-0410-b5e6-96231b3b80d8
ccc1b5eebc6ca8a904c58c0468b9a71483b7c7cf 21-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement name mangling for lambda expressions that occur within the
default arguments of function parameters. This simple-sounding task is
complicated greatly by two issues:

(1) Default arguments aren't actually a real context, so we need to
maintain extra state within lambda expressions to track when a
lambda was actually in a default argument.
(2) At the time that we parse a default argument, the FunctionDecl
doesn't exist yet, so lambda closure types end up in the enclosing
context. It's not clear that we ever want to change that, so instead
we introduce the notion of the "effective" context of a declaration
for the purposes of name mangling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151011 91177308-0d34-0410-b5e6-96231b3b80d8
9e8c92a9c9b949bbb0408fbbd9a58e34894b6efc 20-Feb-2012 Douglas Gregor <dgregor@apple.com> Basic support for name mangling of C++11 lambda expressions. Because
name mangling in the Itanium C++ ABI for lambda expressions is so
dependent on context, we encode the number used to encode each lambda
as part of the lambda closure type, and maintain this value within

Note that there are a several pieces still missing:
- We still get the linkage of lambda expressions wrong
- We aren't properly numbering or mangling lambda expressions that
occur in default function arguments or in data member initializers.
- We aren't (de-)serializing the lambda numbering tables

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150982 91177308-0d34-0410-b5e6-96231b3b80d8
2aed8b88613863f3c439cdfb205bdf8b608fb205 16-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Revert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.""

This reintroduces commit r150682 with a fix for the Bullet benchmark crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150685 91177308-0d34-0410-b5e6-96231b3b80d8
1548d14f4092a817f7d90ad3e7a65266dc85fbc5 16-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself."
It leads to a compiler crash in the Bullet benchmark.

This reverts commit r12014.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150684 91177308-0d34-0410-b5e6-96231b3b80d8
5f688f4b15d02aa7ad159c46b1f78fe59d412f12 16-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.

Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities.

This breaks the static analysis of new expressions. I've filed PR12014 to track this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150682 91177308-0d34-0410-b5e6-96231b3b80d8
9d36f5dc4121f0f931211ea2d0a74d299eb82b23 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement AST (de-)serialization for lambda expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150491 91177308-0d34-0410-b5e6-96231b3b80d8
dfca6f53ab97d28d43e3fa2564209df08f3d282c 13-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce support for template instantiation of lambda
expressions. This is mostly a simple refact, splitting the main "start
a lambda expression" function into smaller chunks that are driven
either from the parser (Sema::ActOnLambdaExpr) or during AST
transformation (TreeTransform::TransformLambdaExpr). A few minor
interesting points:

- Added new entry points for TreeTransform, so that we can
explicitly establish the link between the lambda closure type in the
template and the lambda closure type in the instantiation.
- Added a bit into LambdaExpr specifying whether it had an explicit
result type or not. We should have had this anyway.

This code is 'lightly' tested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150417 91177308-0d34-0410-b5e6-96231b3b80d8
7ae282fde0a12635893931ebf31b35b0d5d5cab3 13-Feb-2012 Douglas Gregor <dgregor@apple.com> Split the storage of lambda information between the LambdaExpr and the
CXXRecordDecl in a way that actually makes some sense:
- LambdaExpr contains all of the information for initializing the
lambda object, including the capture initializers and associated
array index variables.
- CXXRecordDecl's LambdaDefinitionData contains the captures, which
are needed to understand the captured variable references in the
body of the lambda.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150401 91177308-0d34-0410-b5e6-96231b3b80d8
9daa7bfdff7256cef693d7bf10084881bcb9253c 13-Feb-2012 Douglas Gregor <dgregor@apple.com> Keep track of the set of array index variables we use when we
synthesize a by-copy captured array in a lambda. This information will
be needed by IR generation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150396 91177308-0d34-0410-b5e6-96231b3b80d8
da8962a6198bc4bf09a38209db99551b2b0a41a0 13-Feb-2012 Douglas Gregor <dgregor@apple.com> Move the storage of lambda captures and capture initializers from
LambdaExpr over to the CXXRecordDecl. This allows us to eliminate the
back-link from the closure type to the LambdaExpr, which will simplify
and lazify AST deserialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150393 91177308-0d34-0410-b5e6-96231b3b80d8
5b9cc5df25c2198f270dd1d5c438fdce70d4051d 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150318 91177308-0d34-0410-b5e6-96231b3b80d8
cdd1c2ec981a13cf9cfde7f5bc1f7c05af222bbf 09-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Fix a typo in the LambdaExpr class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150139 91177308-0d34-0410-b5e6-96231b3b80d8
76e3da57b0e8cf72d221f44d54566ef206341668 08-Feb-2012 Douglas Gregor <dgregor@apple.com> When completing a lambda expression, make sure to check and attach the
body of the lambda to the function call operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150087 91177308-0d34-0410-b5e6-96231b3b80d8
01d08018b7cf5ce1601707cfd7a84d22015fc04e 07-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
- The representation of lambda captures
- The creation of the non-static data members in the lambda class
that store the captured variables
- The initialization of the non-static data members from the
captured variables
- Pretty-printing lambda expressions

There are a number of FIXMEs, both explicit and implied, including:
- Creating a field for a capture of 'this'
- Improved diagnostics for initialization failures when capturing
variables by copy
- Dealing with temporaries created during said initialization
- Template instantiation
- AST (de-)serialization
- Binding and returning the lambda expression; turning it into a
proper temporary
- Lots and lots of semantic constraints
- Parameter pack captures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149977 91177308-0d34-0410-b5e6-96231b3b80d8
9d9922af13edf3ddf8804a41a98d997324fdd58e 06-Feb-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed instantiation of DependentScopeDeclRefExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149868 91177308-0d34-0410-b5e6-96231b3b80d8
e4b92761b43ced611c417ae478568610f1ad7b1e 27-Jan-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added source location for the template keyword in AST template-id expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149127 91177308-0d34-0410-b5e6-96231b3b80d8
99ba9e3bd70671f3441fb974895f226a83ce0e66 20-Dec-2011 David Blaikie <dblaikie@gmail.com> Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146959 91177308-0d34-0410-b5e6-96231b3b80d8
c8d7f586180995ba33d03c0f6115b6a7bdefe326 29-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Revert r145244. It causes us to create broken ASTs with missing type information
for some cast expressions.

Original commit message:

Removed useless ImplicitCast nodes in explicit cstyle and static casts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145447 91177308-0d34-0410-b5e6-96231b3b80d8
56f5d36fd13c5e271ebd05192c25c88d28e77f8d 28-Nov-2011 Nicola Gigante <nicola.gigante@gmail.com> Removed useless ImplicitCast nodes in explicit cstyle and static casts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145244 91177308-0d34-0410-b5e6-96231b3b80d8
80ee6e878a169e6255d4686a91bb696151ff229f 10-Nov-2011 John McCall <rjmccall@apple.com> There's no good reason to track temporaries in ExprWithCleanups,
but it is sometimes useful to track blocks. Do so. Also
optimize the storage of these expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144263 91177308-0d34-0410-b5e6-96231b3b80d8
ba243b59a1074e0962f6abfa3bb9aa984eac1245 09-Nov-2011 David Blaikie <dblaikie@gmail.com> Fixing 80 col violations (& removing any trailing whitespace on files I was touching anyway)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144171 91177308-0d34-0410-b5e6-96231b3b80d8
7cc58b4c927fca539d43eaa58e00dca95946eb7c 05-Oct-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Added a flag to identify resolved overloaded function references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141171 91177308-0d34-0410-b5e6-96231b3b80d8
a48e676a717309afa50ae06a3d4674acec025bf9 26-Sep-2011 Douglas Gregor <dgregor@apple.com> Re-arrange and bitfieldify data members of CXXConstructExpr to save a
little storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140529 91177308-0d34-0410-b5e6-96231b3b80d8
b0c3e0909bb04af0bfb82ad01ab6909649d68cca 22-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140330 91177308-0d34-0410-b5e6-96231b3b80d8
7110fd6c32306b3feb97b9edb8064b1b68a54e6b 15-Jul-2011 John McCall <rjmccall@apple.com> Add serialization support for SubstNonTypeTemplateParmExpr.
Also add the missing serialization support for SEHTryStmt,
SEHFinallyStmt, and SEHExceptStmt, and fix and finish the
serialization support for AsTypeExpr. In addition, change
the code so that it will no longer link if a Stmt subclass
is missing serialization support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135258 91177308-0d34-0410-b5e6-96231b3b80d8
91a5755ad73c5dc1dfb167e448fdd74e75a6df56 15-Jul-2011 John McCall <rjmccall@apple.com> Create a new expression node, SubstNonTypeTemplateParmExpr,
to represent a fully-substituted non-type template parameter.
This should improve source fidelity, as well as being generically
useful for diagnostics and such.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8
bca01b46850f867b2f4137f25c882022b58f8471 07-Jul-2011 Douglas Gregor <dgregor@apple.com> Properly implement the scope restriction on the NRVO for
throw-expressions, such that we don't consider the NRVO when the
non-volatile automatic object comes from outside the innermost try
scope (C++0x [class.copymove]p13). In C++98/03, our ASTs were
incorrect but it didn't matter because IR generation doesn't actually
apply the NRVO here. In C++0x, however, we were moving from an object
when in fact we should have copied from it. Fixes PR10142 /

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134548 91177308-0d34-0410-b5e6-96231b3b80d8
561f81243f665cf2001caadc45df505f826b72d6 01-Jul-2011 Douglas Gregor <dgregor@apple.com> Introduce the notion of instantiation dependence into Clang's AST. A
type/expression/template argument/etc. is instantiation-dependent if
it somehow involves a template parameter, even if it doesn't meet the
requirements for the more common kinds of dependence (dependent type,
type-dependent expression, value-dependent expression).

When we see an instantiation-dependent type, we know we always need to
perform substitution into that instantiation-dependent type. This
keeps us from short-circuiting evaluation in places where we
shouldn't, and lets us properly implement C++0x [temp.type]p2.

In theory, this would also allow us to properly mangle
instantiation-dependent-but-not-dependent decltype types per the
Itanium C++ ABI, but we aren't quite there because we still mangle
based on the canonical type in cases like, e.g.,

template<unsigned> struct A { };
template<typename T>
void f(A<sizeof(sizeof(decltype(T() + T())))>) { }
template void f<int>(A<sizeof(sizeof(int))>);

and therefore get the wrong answer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134225 91177308-0d34-0410-b5e6-96231b3b80d8
b4b7b5034bb8304ed03416635bf64c75c39889fc 22-Jun-2011 Douglas Gregor <dgregor@apple.com> Give MaterializeTemporaryExpr the exact type of the lvalue it binds
to, including cv-qualifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133618 91177308-0d34-0410-b5e6-96231b3b80d8
0b5810882bd34183c2b764676cafa4c2ce324740 21-Jun-2011 Douglas Gregor <dgregor@apple.com> A few tweaks to MaterializeTemporaryExpr suggested by John.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133528 91177308-0d34-0410-b5e6-96231b3b80d8
03e80030515c800d1ab44125b9052dfffd1bd04c 21-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce a new AST node describing reference binding to temporaries.

MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value.

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
059ce0d92eb5a7da900ae735dc0a2ea3d64f4b0b 01-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Fully implement delegating constructors!

As far as I know, this implementation is complete but might be missing a
few optimizations. Exceptions and virtual bases are handled correctly.

Because I'm an optimist, the web page has appropriately been updated. If
I'm wrong, feel free to downgrade its support categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130642 91177308-0d34-0410-b5e6-96231b3b80d8
25aaf28c5bec71d5d005df67ee78b908ba5940f4 28-Apr-2011 Manuel Klimek <klimek@google.com> Fixes ArrayTypeTraitExpr (-Wnon-virtual-dtor).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130407 91177308-0d34-0410-b5e6-96231b3b80d8
21ff2e516b0e0bc8c1dbf965cb3d44bac3c64330 28-Apr-2011 John Wiegley <johnw@boostpro.com> 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130351 91177308-0d34-0410-b5e6-96231b3b80d8
552622067dc45013d240f73952fece703f5e63bd 25-Apr-2011 John Wiegley <johnw@boostpro.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130122 91177308-0d34-0410-b5e6-96231b3b80d8
ad762fcdc16b9e4705b12b09d92b8c026212b906 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
0fee330f5754ca4b248e5bb7363e834668aff06d 11-Apr-2011 Anders Carlsson <andersca@mac.com> Add CXXDynamicCastExpr::isAlwaysNull() which will be replacing the cast kind I added.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129263 91177308-0d34-0410-b5e6-96231b3b80d8
b277159055933e610bbc80262b600d3ad7e0595c 30-Mar-2011 Ted Kremenek <kremenek@apple.com> Begin reworking static analyzer support for C++ method calls. The current logic was divorced
from how we process ordinary function calls, had a tremendous about of redundancy, and relied
strictly on inlining behavior (which was incomplete) to provide semantics instead of falling
back to the conservative analysis we use for C functions. This is a significant step into
making C++ analyzer support more useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128557 91177308-0d34-0410-b5e6-96231b3b80d8
8026f6d82f7fa544bc0453714fe94bca62a1196e 13-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Instead of storing an ASTContext* in FunctionProtoTypes with computed noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127568 91177308-0d34-0410-b5e6-96231b3b80d8
c2f3e7f42c8bf9e8d4393a6e8c4762dafc4f28dd 07-Mar-2011 John McCall <rjmccall@apple.com> The conditional needs to be pushed before the branch. Make the test less
trivial to check this. Adjust for style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127151 91177308-0d34-0410-b5e6-96231b3b80d8
46bb4f1a3ac9517406887939612eb8df4b7be006 02-Mar-2011 Douglas Gregor <dgregor@apple.com> Eliminate some unused getQualifierRange() member functions. We deal in nested-name-specifier locations now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126842 91177308-0d34-0410-b5e6-96231b3b80d8
4c9be89bb615ec07eb3ed507c8fa9d0baa8a5ad7 28-Feb-2011 Douglas Gregor <dgregor@apple.com> 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126681 91177308-0d34-0410-b5e6-96231b3b80d8
a07992bb4a2c1d21ed7e4376fa6e79342be0fd18 28-Feb-2011 Douglas Gregor <dgregor@apple.com> Remove redundant friend declaration

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126665 91177308-0d34-0410-b5e6-96231b3b80d8
7c3179cf463c3b3b8c21dbb955f933ba50b74f28 28-Feb-2011 Douglas Gregor <dgregor@apple.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126663 91177308-0d34-0410-b5e6-96231b3b80d8
bfdfb5a4119e1c2b173be5d0ca8a91d8c246698f 25-Feb-2011 Matt Beaumont-Gay <matthewbg@google.com> ASTStmtReader is already a friend of DependentScopeDeclRefExpr, and GCC
doesn't like re-friending.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126524 91177308-0d34-0410-b5e6-96231b3b80d8
00cf3cc2718671aa48e8da264a523b0058a8591e 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into
DependentScopeDeclRefExpr. Plus, give NestedNameSpecifierLoc == and !=
operators, since we're going to need 'em elsewhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126508 91177308-0d34-0410-b5e6-96231b3b80d8
f3db29fff6a583ecda823cf909ab7737d8d30129 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source-location information into
pseudo-destructor expressions. Also, clean up some
template-instantiation and type-checking issues with

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126498 91177308-0d34-0410-b5e6-96231b3b80d8
2882eca5a184c78f793188083f6ce539740a5cf2 21-Feb-2011 John McCall <rjmccall@apple.com> Pseudo-revirtualize CallExpr::getSourceRange by making it follow the
logic from CXXMemberCallExpr and by making it check for
CXXOperatorCallExpr in order to defer. This is not really an awesome solution,
but I don't have a better idea.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126114 91177308-0d34-0410-b5e6-96231b3b80d8
e08ce650a2b02410eddd1f60a4aa6b3d4be71e73 09-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125217 91177308-0d34-0410-b5e6-96231b3b80d8
63c00d7f35fa060c0a446c9df3a4402d9c7757fe 09-Feb-2011 John McCall <rjmccall@apple.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125183 91177308-0d34-0410-b5e6-96231b3b80d8
cc324ad80ab940efca006b0064f7ca70a6181816 08-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> AST: support for pre-arg expressions on CallExpr subclasses

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125115 91177308-0d34-0410-b5e6-96231b3b80d8
def0354384d9c4431f7b58b664b59896d4623028 04-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement proper (de-)serialization for explicit template argument
lists with zero template arguments. Fixes some seriously scary
crashers in C++ PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124862 91177308-0d34-0410-b5e6-96231b3b80d8
6ec278d1a354517e20f13a877481453ee7940c78 27-Jan-2011 John McCall <rjmccall@apple.com> Do a proper recursive lookup when deciding whether a class's usual
deallocation function has a two-argument form. Store the result of this
check in new[] and delete[] nodes.

Fixes rdar://problem/8913519

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124373 91177308-0d34-0410-b5e6-96231b3b80d8
c7793c73ba8a343de3f2552d984851985a46f159 15-Jan-2011 Douglas Gregor <dgregor@apple.com> 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123506 91177308-0d34-0410-b5e6-96231b3b80d8
67fd1251aad51bb80d050b7fa5e506fef0ec8e02 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123470 91177308-0d34-0410-b5e6-96231b3b80d8
1d5d0b9df6d2a3df338bc3e63000536406e7666c 12-Jan-2011 Douglas Gregor <dgregor@apple.com> Add the location of the right parenthesis of a C++ named cast
(static_cast, dynamic_cast, reinterpret_cast, or const_cast) to
improve source-location information. Fixes PR8960.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123336 91177308-0d34-0410-b5e6-96231b3b80d8
ee8aff06f6a96214731de17b2cb6df407c6c1820 04-Jan-2011 Douglas Gregor <dgregor@apple.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122813 91177308-0d34-0410-b5e6-96231b3b80d8
aa165f8458b51c546bebff947343e1a36f3594cb 03-Jan-2011 Douglas Gregor <dgregor@apple.com> 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

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122761 91177308-0d34-0410-b5e6-96231b3b80d8
be230c36e32142cbdcdbe9c97511d097beeecbab 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for pack expansions whose pattern is a non-type
template argument (described by an expression, of course). For

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122751 91177308-0d34-0410-b5e6-96231b3b80d8
2e219b8d253dbb901206b14e5643cc9d0edd662b 17-Dec-2010 Francois Pichet <pichet2000@gmail.com> Microsoft's __uuidof operator returns a lvalue. Part 2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122030 91177308-0d34-0410-b5e6-96231b3b80d8
dda0c0dd63bb1ff4a057f1275497e844f99b7909 15-Dec-2010 Nico Weber <nicolasweber@gmx.de> Fix gcc warning: 'clang::ASTStmtReader' is already a friend of 'clang::OverloadExpr'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121852 91177308-0d34-0410-b5e6-96231b3b80d8
bebbe0d9b7568ce43a464286bee49429489ef483 15-Dec-2010 Douglas Gregor <dgregor@apple.com> Variadic templates: extend the Expr class with a bit that specifies
whether the expression contains an unexpanded parameter pack, in the
same vein as the changes to the Type hierarchy. Compute this bit
within all of the Expr subclasses.

This change required a bunch of reshuffling of dependency
calculations, mainly to consolidate them inside the constructors and
to fuse multiple loops that iterate over arguments to determine type
dependence, value dependence, and (now) containment of unexpanded
parameter packs.

Again, testing is painfully sparse, because all of the diagnostics
will change and it is more important to test the to-be-written visitor
that collects unexpanded parameter packs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121831 91177308-0d34-0410-b5e6-96231b3b80d8
e23cf437fe76b1ed02d63c3f61b456fd48a915f5 14-Dec-2010 John McCall <rjmccall@apple.com> Restore r121752 without modification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121763 91177308-0d34-0410-b5e6-96231b3b80d8
5bfe232d1f07a6fd160fcf82c277c055a412a1c0 14-Dec-2010 John McCall <rjmccall@apple.com> Pull out r121752 in case it's causing the selfhost breakage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121759 91177308-0d34-0410-b5e6-96231b3b80d8
0e88aa7100da32acc63bc8a4dcb946ed517868f1 14-Dec-2010 John McCall <rjmccall@apple.com> Factor out most of the extra state in a FunctionProtoType into a separate
class to be passed around. The line between argument and return types and
everything else is kindof vague, but I think it's justifiable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121752 91177308-0d34-0410-b5e6-96231b3b80d8
f187237d916afa97c491ac32fe98be7d335c5b63 08-Dec-2010 Francois Pichet <pichet2000@gmail.com> Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121298 91177308-0d34-0410-b5e6-96231b3b80d8
6ad6f2848d7652ab2991286eb48be440d3493b28 07-Dec-2010 Francois Pichet <pichet2000@gmail.com> Type traits intrinsic implementation: __is_base_of(T, U)
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121074 91177308-0d34-0410-b5e6-96231b3b80d8
4765fa05b5652fcc4356371c2f481d0ea9a1b007 06-Dec-2010 John McCall <rjmccall@apple.com> Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
dfa1edbebeda7ec3a7a9c45e4317de9241aa9883 23-Nov-2010 John McCall <rjmccall@apple.com> A few tweaks to the value-kind computation:
- Default argument expressions pick up the value kind of the incoming
expression, not the value kind of the parameter it initializes.
- When building a template argument for substitution, A::x is an rvalue
if x is an instance method.
- Anonymous struct/union paths pick up value kind the same way that
normal member accesses do; extract out a common code path for this.

Enable the value-kind assertion, now that it passes self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120055 91177308-0d34-0410-b5e6-96231b3b80d8
0943168ac126b8047f30f6bd215fbe7db14d61ba 18-Nov-2010 John McCall <rjmccall@apple.com> Add an assertion, fix a whole bunch of bugs, comment the assertion
out because there are still bugs left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119722 91177308-0d34-0410-b5e6-96231b3b80d8
f89e55ab1bfb3ea997f8b02997c611a02254eb2d 18-Nov-2010 John McCall <rjmccall@apple.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
a437ad3ec5b407ede394d74e6f9f463fa3657dbe 16-Nov-2010 Craig Silverstein <csilvers2000@yahoo.com> Have CXXDeleteExpr::getDestroyedType return the actual destroyed type
in more situations. In particular, for code like

template<class T> void Fn() { T* x; delete x; }

getDestroyedType() will now return T rather than T*, as it would
before this change. On the other hand, for code like this:

template<class T> void Fn() { T x; delete x; }

getDestroyedType() will return an empty QualType(), since it doesn't
know what the actual destroyed type would be. Previously, it would
return T.

OKed by rjmccall

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119334 91177308-0d34-0410-b5e6-96231b3b80d8
b8e39236f05b2f71fb2632673948499fd54e2a34 02-Nov-2010 Fariborz Jahanian <fjahanian@apple.com> Fixes an assertion violation when bind to temporary
expression is a dependent expression.
// rdar: // 8620524 and PR7851

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118066 91177308-0d34-0410-b5e6-96231b3b80d8
007a9b1c632bfaac20e41c60cbe07fdc6d0e647c 27-Oct-2010 Chandler Carruth <chandlerc@gmail.com> Add helper for extracting the CXXRecordDecl for the implicit argument to
a member call expression. This has proved to be a common pattern for users of

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117439 91177308-0d34-0410-b5e6-96231b3b80d8
428edafa9eb80e01dd40aab31d4166a787a741e1 25-Oct-2010 Chandler Carruth <chandlerc@gmail.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117254 91177308-0d34-0410-b5e6-96231b3b80d8
4045107b7384fd68eed5e3e2f06fc2a47e7be0a6 15-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write to/from PCH DeclarationNameLocs, DeclarationNameInfos and QualifierInfos (rdar://8513756).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116598 91177308-0d34-0410-b5e6-96231b3b80d8
5833b0b831d6afae2885e6af420e2bda639652e6 15-Sep-2010 Douglas Gregor <dgregor@apple.com> 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113883 91177308-0d34-0410-b5e6-96231b3b80d8
0dfd848fa4c9664852ba8c929a8bd3fce93ddca2 13-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Eagerly evaluate type traits in Sema instead of lazily in AST. They actually need Sema access to be correct, fixes coming up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113782 91177308-0d34-0410-b5e6-96231b3b80d8
4076dacf1497fb95cb298b9d964fbdbdaf9bde6c 13-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> When applying 'delete' on a pointer-to-array type match GCC and EDG behavior and treat it as 'delete[]'.
Also offer a fix-it hint adding '[]'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113778 91177308-0d34-0410-b5e6-96231b3b80d8
f1b8911d35bb2830a13267581d3cbde4b6b85db6 13-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove the trivial setters from CXXDeleteExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113777 91177308-0d34-0410-b5e6-96231b3b80d8
5221d8f2da008689f7ff9476e6522bb2b63ec1a3 11-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Address Doug's comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113650 91177308-0d34-0410-b5e6-96231b3b80d8
c8aecc2dfb2e393d9eeaedeca22ff8cd7149af81 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Follow Ted's example and hide CXXNoexceptExpr's setters from all but serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113634 91177308-0d34-0410-b5e6-96231b3b80d8
6b219d082434394c1ac401390ec1d1967727815a 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Serialization support for CXXNoexceptExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113627 91177308-0d34-0410-b5e6-96231b3b80d8
2e156225a29407a50dd19041aa5750171ad44ea3 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Define and implement CXXNoexceptExpr. Create it in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113623 91177308-0d34-0410-b5e6-96231b3b80d8
3d37c0ada0e46b87be0a10e8d52d990a97d3907a 09-Sep-2010 Douglas Gregor <dgregor@apple.com> Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113492 91177308-0d34-0410-b5e6-96231b3b80d8
01b7c3028da5bbcb9f8e52ba67e4613070de0e60 08-Sep-2010 Francois Pichet <pichet2000@gmail.com> Microsoft's __uuidof operator implementation part 1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113356 91177308-0d34-0410-b5e6-96231b3b80d8
ab6677ec401cfd2c82b34e4cdfebd55a9dc25778 08-Sep-2010 Douglas Gregor <dgregor@apple.com> Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113319 91177308-0d34-0410-b5e6-96231b3b80d8
1bb2a93ab7b1499dda6f6b58865bd0dce1864228 07-Sep-2010 Douglas Gregor <dgregor@apple.com> Improve source-location information for CXXNewExpr, by hanging on to
the TypeSourceInfo for the allocated type. Fixes PR7501.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113291 91177308-0d34-0410-b5e6-96231b3b80d8
e2ca6d4a2f41876930fbd304caa706452d2569d8 02-Sep-2010 Douglas Gregor <dgregor@apple.com> Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112868 91177308-0d34-0410-b5e6-96231b3b80d8
6cf750298d3621d8a10a6dd07fcee8e274b9d94d 30-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
0016d519b831859526b79405cdae4c64c73731c8 29-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
9c72c6088d591ace8503b842d39448c2040f3033 27-Aug-2010 John McCall <rjmccall@apple.com> Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112258 91177308-0d34-0410-b5e6-96231b3b80d8
096832c5ed5b9106fa177ebc148489760c3bc496 20-Aug-2010 John McCall <rjmccall@apple.com> Regularize the API for accessing explicit template arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111584 91177308-0d34-0410-b5e6-96231b3b80d8
60adf4acf40b72227740bf966fb87eebddff3f37 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename PCHStmtReader -> ASTStmtReader.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111470 91177308-0d34-0410-b5e6-96231b3b80d8
3397c5570369f19b2d6c52e898f708d75ceede1f 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Do the PCH->AST rename for ASTWriter's implementation parts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111464 91177308-0d34-0410-b5e6-96231b3b80d8
2577743c5650c646fb705df01403707e94f2df04 12-Aug-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Added locations and type source info for DeclarationName.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110860 91177308-0d34-0410-b5e6-96231b3b80d8
f871d0cc377a1367b519a6cce26be74607566eba 07-Aug-2010 John McCall <rjmccall@apple.com> Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths. Avoids a separate allocation and
another word of overhead in cases needing inheritance paths. Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
7cb6bd70f9436f630a508ba017414ca2466eeb35 25-Jul-2010 Douglas Gregor <dgregor@apple.com> Remove a bunch of trivial destructors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109382 91177308-0d34-0410-b5e6-96231b3b80d8
ff331c15729f7d4439d253c97f4d60f2a7ffd0c6 25-Jul-2010 Douglas Gregor <dgregor@apple.com> Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109377 91177308-0d34-0410-b5e6-96231b3b80d8
e4b8f1171d699c56ba2b39aabf1d7cb4c38ce4f8 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Properly add to 32

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108243 91177308-0d34-0410-b5e6-96231b3b80d8
4bd40318cbea15310a37343db46de96c4fcc15e6 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Downgrade the "when type is in parentheses, array cannot have dynamic
size" error for code like

new (int [size])

to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108242 91177308-0d34-0410-b5e6-96231b3b80d8
6d00c1365dd3601f6d93bbda9162913c57ae788f 10-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add PCH support for the remaining C++ exprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108042 91177308-0d34-0410-b5e6-96231b3b80d8
ed8abf18329df67b0abcbb3a10458bd8c1d2a595 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
84745677f64863e025a6733cb29d0b94bc3a6ae2 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
016a4a90c8e75d59de731fa3aa98f0a55656e66c 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
newly-narrowed scope. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107828 91177308-0d34-0410-b5e6-96231b3b80d8
63ef464c3fad1e8b9f9360baa6c81f974b712e90 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Do not use CXXZeroValueInitExpr for class types. Instead, use
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107827 91177308-0d34-0410-b5e6-96231b3b80d8
8a50733034edd6a349b34e2b9f0c8d0a874846d3 03-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix broken PCH support for CXXDefaultArgExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107541 91177308-0d34-0410-b5e6-96231b3b80d8
de4bd18bb45a1db68996cfb949db3015fc25d10d 28-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support CXXPseudoDestructorExpr for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106999 91177308-0d34-0410-b5e6-96231b3b80d8
12dffcddb60380c5bed4f085a1f51534afda3b87 28-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support DependentScopeDeclRefExpr for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106998 91177308-0d34-0410-b5e6-96231b3b80d8
36c76f0bea0d3595a25a5362225c642019cc3176 28-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactor PCH reading/writing of template arguments passed to expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106997 91177308-0d34-0410-b5e6-96231b3b80d8
bd65bb511c26549c96b829c1282e4c877588564a 25-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support UnresolvedLookupExpr for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106832 91177308-0d34-0410-b5e6-96231b3b80d8
a77eb0862507b900a10fa352af1568e639ed10b1 25-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support UnresolvedMemberExpr for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106831 91177308-0d34-0410-b5e6-96231b3b80d8
8dfbd8b252ba4e6cf4b7a3422f6ef0ca21312dfe 24-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support a couple more C++ Exprs for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106727 91177308-0d34-0410-b5e6-96231b3b80d8
95fc98ce95d4faa4f1bb2783384150530404ea6f 22-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write CXXDeleteExpr from/to PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106552 91177308-0d34-0410-b5e6-96231b3b80d8
928e6fcf66fc4f342bcf7cc96bf56986c9c2a833 23-May-2010 Douglas Gregor <dgregor@apple.com> Move OverloadExpr over to a ASTContext-allocated pointer for its
storage, rather than an UnresolvedSet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104469 91177308-0d34-0410-b5e6-96231b3b80d8
5a84dec38cfa9e084377a3167b474c79283c82fa 23-May-2010 Douglas Gregor <dgregor@apple.com> Provide the overloaded functions for UnresolvedLookupExpr and
UnresolvedMemberExpr in their constructors, rather than adding them
after the fact. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104468 91177308-0d34-0410-b5e6-96231b3b80d8
d04ed416be7c55bddddab1fa3fd38a0113a6b3da 10-May-2010 Ted Kremenek <kremenek@apple.com> Convert CXXTempory[] in CXXExprWithTemporaries to be allocated using ASTContext's allocator. Fixes <rdar://problem/7961605>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103421 91177308-0d34-0410-b5e6-96231b3b80d8
5921863d8f24084797863b5df37842113bac4352 10-May-2010 Chris Lattner <sabre@nondot.org> pch'ify CXXNewExpr and CXXZeroInitValueExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103390 91177308-0d34-0410-b5e6-96231b3b80d8
ddfe960d252a93525692b547945236d361d1929f 10-May-2010 Chandler Carruth <chandlerc@gmail.com> Doxygen-ify a comment and add an example of when this AST node is required.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103389 91177308-0d34-0410-b5e6-96231b3b80d8
d2598368876cfe40bc8465540033bc5b5e58d8af 10-May-2010 Chris Lattner <sabre@nondot.org> pchify CXXTemporary, CXXBindTemporaryExpr, and

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103387 91177308-0d34-0410-b5e6-96231b3b80d8
030854b95f7bfd86aaa8afd9ae1aff9768a37e9a 09-May-2010 Chris Lattner <sabre@nondot.org> pch'ify default argument definitions and uses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103376 91177308-0d34-0410-b5e6-96231b3b80d8
2fbdfcdf3bbf7b941853d38b123930755e837437 09-May-2010 Chris Lattner <sabre@nondot.org> pch'ify 'this' and 'throw'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103375 91177308-0d34-0410-b5e6-96231b3b80d8
14ab24f01e36d495fce183aa67b41e45cdd54f39 09-May-2010 Chris Lattner <sabre@nondot.org> pch'ify typeid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103374 91177308-0d34-0410-b5e6-96231b3b80d8
1817bd483b538fd3f4530649f5cb900bad9e8a76 09-May-2010 Chris Lattner <sabre@nondot.org> pchify CXXMemberCallExpr correctly. Before it would serialize
and deserialize as a CallExpr which is close, but ends up
deserializing with the wrong stmt class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103371 91177308-0d34-0410-b5e6-96231b3b80d8
fcaeef2ae00ec643eb024e0aca2c98701cf5627c 03-May-2010 Anders Carlsson <andersca@mac.com> Change CXXConstructExpr::Create to take a ConstructionKind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102884 91177308-0d34-0410-b5e6-96231b3b80d8
24eb78e38aba55c507bc3c05c37035a9ab2defa7 03-May-2010 Anders Carlsson <andersca@mac.com> Pass the construction kind down to EmitCXXConstructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102880 91177308-0d34-0410-b5e6-96231b3b80d8
72e96fd181b19b8d01144a685cda6e955584c7ea 03-May-2010 Anders Carlsson <andersca@mac.com> Add an enum to CXXConstructExpr so we can determine if the construction expression constructs a non-virtual or virtual base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102879 91177308-0d34-0410-b5e6-96231b3b80d8
1c63b9c15d48cb8c833a4b2d6fd6c496c0766e88 27-Apr-2010 Douglas Gregor <dgregor@apple.com> When explicitly building a temporary object (CXXTemporaryObjectExpr),
keep track of whether we need to zero-initialize storage prior to
calling its constructor. Previously, we were only tracking this when
implicitly constructing the object (a CXXConstructExpr).

Fixes Boost's value-initialization tests, which means that the
Boost.Config library now passes all of its tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102461 91177308-0d34-0410-b5e6-96231b3b80d8
57fdc8a4382164955c7b30d09f4ce46fc7e67659 27-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve source-location information in a C++ typeid (type) expression
by using TypeSourceInfo, cleaning up the representation
somewhat. Teach getTypeOperand() to strip references and
cv-qualifiers, providing the semantic view of the type without
requiring any extra storage (the unmodified type remains within the
TypeSourceInfo). This fixes a bug found by Boost's call_traits test.

Finally, clean up semantic analysis, by splitting the ActOnCXXTypeid
routine into ActOnCXXTypeId (the parser action) and two BuildCXXTypeId
functions, which perform the semantic analysis for typeid(type) and
typeid(expression), respectively. We now perform less work at template
instantiation time (we don't look for std::type_info again) and can
give better diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102393 91177308-0d34-0410-b5e6-96231b3b80d8
41b2dcd465f1e438502c420effc9d0c747f9db8f 24-Apr-2010 Anders Carlsson <andersca@mac.com> Add BasePath arguments to all cast expr constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102258 91177308-0d34-0410-b5e6-96231b3b80d8
e9ee23edd17c4bb7f271e67f8790792b4de677fc 22-Apr-2010 John McCall <rjmccall@apple.com> Use the naming class from the overloaded lookup when access-checking an
address of overloaded function, instead of assuming that a nested name
specifier was used. A nested name specifier is not required for static

Fixes PR6886.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102107 91177308-0d34-0410-b5e6-96231b3b80d8
d8383d45e41ba2316610e5d638d2872e37b67cfb 21-Apr-2010 Zhongxing Xu <xuzhongxing@gmail.com> CXXNamedCastExpr is actually an abstract expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101994 91177308-0d34-0410-b5e6-96231b3b80d8
db2eb5abf4c082d1f0c5c45e39d8cd0300f81e38 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Remove the AST statistics tracking I added yesterday; it didn't pan out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100027 91177308-0d34-0410-b5e6-96231b3b80d8
264ba48dc98f3f843935a485d5b086f7e0fdc4f1 30-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> the big refactoring bits of PR3782.

This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99920 91177308-0d34-0410-b5e6-96231b3b80d8
f540305c5d834ad9412b41805b81a74249b7c5af 30-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce new AST statistics that keep track of the number of isa (or
dyn_cast) invocations for C++ and Objective-C types, declarations,
expressions, and statements. The statistics will be printed when
-print-stats is provided to Clang -cc1, with results such as:

277073 clang - Number of checks for C++ declaration nodes
13311 clang - Number of checks for C++ expression nodes
18 clang - Number of checks for C++ statement nodes
174182 clang - Number of checks for C++ type nodes
92300 clang - Number of checks for Objective-C declaration nodes
9800 clang - Number of checks for Objective-C expression nodes
7 clang - Number of checks for Objective-C statement nodes
65733 clang - Number of checks for Objective-C type nodes

The statistics are only gathered when NDEBUG is not defined, since
they introduce potentially-expensive operations into very low-level
routines (isa).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99912 91177308-0d34-0410-b5e6-96231b3b80d8
a2e7dd2f4a50d835351153aee568d35ccc986310 25-Feb-2010 Douglas Gregor <dgregor@apple.com> Use CXXPseudoDestructorExpr as the stored representation for dependent
expressions that look like pseudo-destructors, e.g.,


where p has dependent type.

At template instantiate time, we determine whether we actually have a
pseudo-destructor or a member access, and funnel down to the
appropriate routine in Sema.

Fixes PR6380.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97092 91177308-0d34-0410-b5e6-96231b3b80d8
fce46ee68f779e239826e69e45d01d4c8e5323ca 25-Feb-2010 Douglas Gregor <dgregor@apple.com> Keep track of the location of the '~' in a pseudo-destructor expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97080 91177308-0d34-0410-b5e6-96231b3b80d8
26d4ac97fb514bb60c2536eae6f203dc569159d9 25-Feb-2010 Douglas Gregor <dgregor@apple.com> Retain complete source information for the type after the '~' in a

Update template instantiation for pseudo-destructor expressions to use
this source information and to make use of
Sema::BuildPseudoDestructorExpr when the base expression is dependent
or refers to a scalar type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97079 91177308-0d34-0410-b5e6-96231b3b80d8
e0601ea1220348957dacec5f3dd0707837365290 24-Feb-2010 Douglas Gregor <dgregor@apple.com> Retain source information for the "type-name ::" in a
pseudo-destructor expression such as


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97060 91177308-0d34-0410-b5e6-96231b3b80d8
ce056bcaa1c97b89a4b2de2112c62d060863be2b 21-Feb-2010 Douglas Gregor <dgregor@apple.com> Eliminate the default arguments to ASTContext::getFunctionType(),
fixing up a few callers that thought they were propagating NoReturn
information but were in fact saying something about exception

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96766 91177308-0d34-0410-b5e6-96231b3b80d8
ad7fe864862305c2f71e047cdf6706ef43aebdc0 11-Feb-2010 Ted Kremenek <kremenek@apple.com> Fix leak in CXXNewExpr where the SubExprs array would get allocated directly using 'new[]' instead of the allocator associated with ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95933 91177308-0d34-0410-b5e6-96231b3b80d8
eb7f96141f754150a92433286fa385910a22f494 07-Feb-2010 Sam Weinig <sam.weinig@gmail.com> Roll r95513 back in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95515 91177308-0d34-0410-b5e6-96231b3b80d8
a8ad5d4975aea17c0e7868f83c25083a0eb2040d 07-Feb-2010 Sam Weinig <sam.weinig@gmail.com> Roll out r95513, it seems to have broken self hosting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95514 91177308-0d34-0410-b5e6-96231b3b80d8
1eb1113b139503a3895714d94ec9c037ae62d3b1 07-Feb-2010 Sam Weinig <sam.weinig@gmail.com> Add PCH support for CXXBoolLiteralExpr and CXXNullPtrLiteralExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95513 91177308-0d34-0410-b5e6-96231b3b80d8
2f27bf854f0519810b34afd209089cc75536b757 04-Feb-2010 John McCall <rjmccall@apple.com> Mangle member expressions. Also invented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95284 91177308-0d34-0410-b5e6-96231b3b80d8
1dd7383dc48718c452e71a625b29531dd96fbb9d 04-Feb-2010 John McCall <rjmccall@apple.com> Add mangling support for calls, sizeof/alignof, constructor calls,
float literals, and unresolved lookups (which required hand-wavey extensions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95273 91177308-0d34-0410-b5e6-96231b3b80d8
7bb12da2b0749eeebb21854c77877736969e59f2 02-Feb-2010 John McCall <rjmccall@apple.com> Extract a common base class between UnresolvedLookupExpr and
UnresolvedMemberExpr and employ it in a few places where it's useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95072 91177308-0d34-0410-b5e6-96231b3b80d8
9db7dbb918ca49f4ee6c181e4917e7b6ec547353 31-Jan-2010 Douglas Gregor <dgregor@apple.com> 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

- 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

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
4e1c181e2bb378dad55dd25c18611e3a0fb6c22a 29-Jan-2010 Anders Carlsson <andersca@mac.com> Add getters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94803 91177308-0d34-0410-b5e6-96231b3b80d8
eb60edffa147e061278c436e513b0df9b4c4e7f6 29-Jan-2010 Anders Carlsson <andersca@mac.com> Add an CXXBindReferenceExpr (not used just yet).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94791 91177308-0d34-0410-b5e6-96231b3b80d8
c373d48502ca7683ab55385f5bd624d778eb288d 27-Jan-2010 John McCall <rjmccall@apple.com> Implement access control for overloaded functions. Suppress access control
diagnostics in "early" lookups, such as during typename checks and when building
unresolved lookup expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94647 91177308-0d34-0410-b5e6-96231b3b80d8
75345163535eb1765ba8fb971974be895645cb45 26-Jan-2010 John McCall <rjmccall@apple.com> Avoid some unnecessary copying of unresolved lookup results.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94531 91177308-0d34-0410-b5e6-96231b3b80d8
6e26689f5d513e24ad7783a4493201930fdeccc0 26-Jan-2010 John McCall <rjmccall@apple.com> Preserve access bits through overload resolution much better. Some
general refactoring in operator resolution.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94498 91177308-0d34-0410-b5e6-96231b3b80d8
eec51cf1ba5f0e62c9cdb81b5c63babdd6e649ab 20-Jan-2010 John McCall <rjmccall@apple.com> Give UnresolvedSet the ability to store access specifiers for each declaration.
Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its
own header and make it templated over an inline capacity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93959 91177308-0d34-0410-b5e6-96231b3b80d8
ce757a7a1ee905f87551996a69da3e95e8afeeb7 16-Jan-2010 Sam Weinig <sam.weinig@gmail.com> Add PCH support for CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, CXXConstCastExpr and CXXFunctionalCastExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93658 91177308-0d34-0410-b5e6-96231b3b80d8
9d125033a9853f3b572a4c9e2f9e2d4e5e346973 15-Jan-2010 John McCall <rjmccall@apple.com> Preserve type source information in explicit cast expressions.
Patch by Enea Zaffanella.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93522 91177308-0d34-0410-b5e6-96231b3b80d8
828a197317288e3333b0ce6f5cedadd036e3531f 08-Jan-2010 Douglas Gregor <dgregor@apple.com> Add an "implicit" bit to CXXThisExpr, so that we can track
implicitness without losing track of the (logical or actual) location
where "this" would occur in the source.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92958 91177308-0d34-0410-b5e6-96231b3b80d8
2333f7727f97018d6742e1e0938133bcfad967ab 30-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Make sure to explicitly pass type/value dependence to Expr constructor. This
caught several cases where we were not doing the right thing. I'm
not completely sure all cases are being handled correctly, but this should
be an improvement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92281 91177308-0d34-0410-b5e6-96231b3b80d8
036aed18662e0193aafe0e8ae13d2e57efe6df25 24-Dec-2009 Douglas Gregor <dgregor@apple.com> When we see a CXXDefaultArgExpr during template instantiation, rebuild
the default argument so that we're sure to mark any referenced
declarations. This gets us another little step closer to fixing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92078 91177308-0d34-0410-b5e6-96231b3b80d8
65222e82d97af2120b3952d19cbd3cd923f4b43e 23-Dec-2009 Douglas Gregor <dgregor@apple.com> When using a default function argument for a function template (or
member function thereof), perform the template instantiation each time
the default argument is needed. This ensures that
(1) We get different CXXTemporary objects for each instantiation, and
(2) Any other instantiations or definitions triggered by the
instantiation of the default argument expression are guaranteed to
happen; previously, they might have been suppressed, e.g., because
they happened in an unevaluated context.

This fixes the majority of PR5810. However, it does not address the
problem where we may have multiple uses of the same CXXTemporary
within an expression when the temporary came from a non-instantiated
default argument expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92015 91177308-0d34-0410-b5e6-96231b3b80d8
e383768f7f5d45ca4af0b1c11cbf072de18bce98 23-Dec-2009 Ted Kremenek <kremenek@apple.com> Fix CXXConstructExpr::getSourceRange() to not include the source ranges of CXXDefaultArgExprs when computing its range (since these expressions have no source range, and using them will make the encompassing range invalid).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91984 91177308-0d34-0410-b5e6-96231b3b80d8
16006c901315fa12a108b4e571f187f4b676e426 16-Dec-2009 Douglas Gregor <dgregor@apple.com> When value-initializing a class with no user-defined constructors but
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91548 91177308-0d34-0410-b5e6-96231b3b80d8
99a2e600f9e2e51d3ce10fb6f27191677ac65b2a 16-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch the C++ new expression over to InitializationSequence, rather
than using its own partial implementation of initialization.

Switched CheckInitializerTypes over to
InitializedEntity/InitializationKind, to help move us closer to

Added InitializedEntity::getName() to retrieve the name of the entity,
for diagnostics that care about such things.

Implemented support for default initialization in

Clean up the determination of the "source expressions" for an
initialization sequence in InitializationSequence::Perform.

Taught CXXConstructExpr to store more location information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91492 91177308-0d34-0410-b5e6-96231b3b80d8
0ece491d8f62ce67f047491a6703fac0d3bd4ff4 15-Dec-2009 Anders Carlsson <andersca@mac.com> ShouldDestroyTemporaries? I don't think so.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91450 91177308-0d34-0410-b5e6-96231b3b80d8
a88cfbfac9bbcbb9858f048d6d73a48711d8e93d 12-Dec-2009 Douglas Gregor <dgregor@apple.com> Rework the way we handle template instantiation for
implicitly-generated AST nodes. We previously built instantiated nodes
for each of these AST nodes, then passed them on to Sema, which was
not prepared to see already-type-checked nodes (see PR5755). In some
places, we had ugly workarounds to try to avoid re-type-checking
(e.g., in VarDecl initializer instantiation).

Now, we skip implicitly-generated nodes when performing instantiation,
preferring instead to build just the AST nodes that directly reflect
what was written in the source code. This has several advantages:

- We don't need to instantiate anything that doesn't have a direct
correlation to the source code, so we can have better location
- Semantic analysis sees the same thing at template instantiation
time that it would see for a non-template.
- At least one ugly hack (VarDecl initializers) goes away.

Fixes PR5755.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91218 91177308-0d34-0410-b5e6-96231b3b80d8
aa81e1658d87b9011125c632aa902d154ae4b02c 01-Dec-2009 John McCall <rjmccall@apple.com> Rework how we support C++ implicit member accesses. If we can resolve an
implicit member access to a specific declaration, go ahead and create
it as a DeclRefExpr or a MemberExpr (with implicit CXXThisExpr base) as
appropriate. Otherwise, create an UnresolvedMemberExpr or
DependentScopeMemberExpr with a null base expression.

By representing implicit accesses directly in the AST, we get the ability
to correctly delay the decision about whether it's actually an instance
member access or not until resolution is complete. This permits us
to correctly avoid diagnosing the 'problem' of 'MyType::foo()'
where the relationship to the type isn't really known until instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90266 91177308-0d34-0410-b5e6-96231b3b80d8
129e2df52ed7e0434b3f1cf1867fd6a5cb083ff6 30-Nov-2009 John McCall <rjmccall@apple.com> Eliminate the use of OverloadedFunctionDecl in member expressions.
Create a new UnresolvedMemberExpr for these lookups. Assorted hackery
around qualified member expressions; this will all go away when we
implement the correct (i.e. extremely delayed) implicit-member semantics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90161 91177308-0d34-0410-b5e6-96231b3b80d8
99e9b4d172f6877e6ba5ebe75bb8238721f5e01c 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Eliminate CXXConditionDeclExpr with extreme prejudice.

All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).

Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting

Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89817 91177308-0d34-0410-b5e6-96231b3b80d8
f7a1a744eba4b29ceb0f20af8f34515d892fdd64 24-Nov-2009 John McCall <rjmccall@apple.com> Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and
DependentScopeDeclRefExpr support storing templateids. Unite the common
code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr.

This gets us to a point where we don't need to store function templates in
the AST using TemplateNames, which is critical to ripping out OverloadedFunction.

Also resolves a few FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89785 91177308-0d34-0410-b5e6-96231b3b80d8
0da76df9218d7c27b471b0a4d83a5b29fe24e5b4 23-Nov-2009 Douglas Gregor <dgregor@apple.com> Centralize and complete the computation of value- and type-dependence for DeclRefExprs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89649 91177308-0d34-0410-b5e6-96231b3b80d8
d5532b6cfff2977e0c59fa6ead7f7973984a620d 23-Nov-2009 John McCall <rjmccall@apple.com> Encapsulate "an array of TemplateArgumentLocs and two angle bracket locations" into
a new class. Use it pervasively throughout Sema.

My fingers hurt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89638 91177308-0d34-0410-b5e6-96231b3b80d8
7453ed4cb2cab113de3378df371b1c6f1243d832 22-Nov-2009 John McCall <rjmccall@apple.com> Consider a FunctionTemplate to be an overload all on its lonesome. Track
this information through lookup rather than rederiving it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89570 91177308-0d34-0410-b5e6-96231b3b80d8
ba13543329afac4a0d01304ec2ec4924d99306a6 21-Nov-2009 John McCall <rjmccall@apple.com> "Incremental" progress on using expressions, by which I mean totally ripping
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of
a function template in the lookup results.

Incidentally fixes a problem with argument-dependent lookup where we were
still performing ADL even when the lookup results contained something from
a block scope.

Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.

The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89544 91177308-0d34-0410-b5e6-96231b3b80d8
865d447ac6a4721ab58e898d014a21f2eff74b06 19-Nov-2009 John McCall <rjmccall@apple.com> Draw a brighter line between "unresolved" expressions, where we have done the
appropriate lookup and simply can't resolve the referrent yet, and
"dependent scope" expressions, where we can't do the lookup yet because the
entity we need to look into is a dependent type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89402 91177308-0d34-0410-b5e6-96231b3b80d8
00b98c229ef28a5e82943bb23d09fb46d24ca381 12-Nov-2009 Douglas Gregor <dgregor@apple.com> Improve source-location information for implicitly-generated member call expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86989 91177308-0d34-0410-b5e6-96231b3b80d8
833ca991c1bfc967f0995974ca86f66ba1f666b5 29-Oct-2009 John McCall <rjmccall@apple.com> Track source information for template arguments and template specialization
types. Preserve it through template instantiation. Preserve it through PCH,
although TSTs themselves aren't serializable, so that's pretty much meaningless.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85500 91177308-0d34-0410-b5e6-96231b3b80d8
a2813cec2605ce7878d1b13471d685f689b251af 23-Oct-2009 Douglas Gregor <dgregor@apple.com> Eliminate QualifiedDeclRefExpr, which captured the notion of a
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g.,

namespace N { int i; }
int j = N::i;

Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.

Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84962 91177308-0d34-0410-b5e6-96231b3b80d8
96be6917e1c4ba1f4435a14c9e7c6c139571d086 24-Sep-2009 Douglas Gregor <dgregor@apple.com> Make C++ temporary-related expressions provide proper source-range information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82665 91177308-0d34-0410-b5e6-96231b3b80d8
c0a2fd8f092722c8f78b566ac4506a21437040e9 15-Sep-2009 Anders Carlsson <andersca@mac.com> Get rid of the CastInfo struct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81839 91177308-0d34-0410-b5e6-96231b3b80d8
7f9e646b7ed47bc8e9a60031ad0c2b55031e2077 15-Sep-2009 Anders Carlsson <andersca@mac.com> Handle reinterpret_cast between integral types and pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81837 91177308-0d34-0410-b5e6-96231b3b80d8
39da0b8145eaec7da7004f9b3645c5c9f4f63b1d 10-Sep-2009 Douglas Gregor <dgregor@apple.com> Improve handling of initialization by constructor, by ensuring that
such initializations properly convert constructor arguments and fill
in default arguments where necessary. This also makes the ownership
model more clear.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81394 91177308-0d34-0410-b5e6-96231b3b80d8
0aebc81e02397a5987aaa8e8c7acbdb01a31d7c3 09-Sep-2009 Anders Carlsson <andersca@mac.com> If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81383 91177308-0d34-0410-b5e6-96231b3b80d8
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
3b6afbb99a1c44b4076f8e15fb7311405941b306 09-Sep-2009 Douglas Gregor <dgregor@apple.com> Initial stab at implement dependent member references to member
templates, e.g.,

x.template get<T>

We can now parse these, represent them within an UnresolvedMemberExpr
expression, then instantiate that expression node in simple cases.

This allows us to stumble through parsing LLVM's Casting.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81300 91177308-0d34-0410-b5e6-96231b3b80d8
bcb11d01c034f967503bd98f28bdf458c1ab8001 08-Sep-2009 Anders Carlsson <andersca@mac.com> Clean up the CXXConstructExpr constructor, add Arg getters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81178 91177308-0d34-0410-b5e6-96231b3b80d8
a71d819bb8f50c28938db0f2867d3fb6e2ce5910 04-Sep-2009 Douglas Gregor <dgregor@apple.com> Implement AST, semantics, and CodeGen for C++ pseudo-destructor
expressions, e.g.,


when p is a pointer to a scalar type.

We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81009 91177308-0d34-0410-b5e6-96231b3b80d8
c68afe2cbe7f875a9243c411077602fb5f5dc74b 03-Sep-2009 Douglas Gregor <dgregor@apple.com> Improve template instantiation for member access expressions that
involve qualified names, e.g., x->Base::f. We now maintain enough
information in the AST to compare the results of the name lookup of
"Base" in the scope of the postfix-expression (determined at template
definition time) and in the type of the object expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80953 91177308-0d34-0410-b5e6-96231b3b80d8
a38c687ef5354678b9d76a7b29354159f2b83736 03-Sep-2009 Douglas Gregor <dgregor@apple.com> Improved handling for dependent, qualified member access expressions, e.g.,


where t has a dependent type. We save the nested-name-specifier in the
CXXUnresolvedMemberExpr then, during instantiation, substitute into
the nested-name-specifier with the (transformed) object type of t, so
that we get name lookup into the type of the object expression.

Note that we do not yet retain information about name lookup into the
lexical scope of the member access expression, so several regression
tests are still disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80925 91177308-0d34-0410-b5e6-96231b3b80d8
83f6faf37d9bf58986bedc9bc0ea897a56b4dbad 01-Sep-2009 Douglas Gregor <dgregor@apple.com> Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocate
space within the MemberExpr for the nested-name-specifier and its
source range. We'll do the same thing with explicitly-specified
template arguments, assuming I don't flip-flop again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80642 91177308-0d34-0410-b5e6-96231b3b80d8
0979c805475d1ba49b5d6ef93c4d2ce6d2eab6ed 31-Aug-2009 Douglas Gregor <dgregor@apple.com> Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we will
also be adding explicit template arguments as an additional
"adornment". No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80628 91177308-0d34-0410-b5e6-96231b3b80d8
bd4c4aebe6035e7a7125470cc9f0f92511230ee3 27-Aug-2009 Douglas Gregor <dgregor@apple.com> When a member reference expression includes a qualifier on the member
name, e.g.,


retain the qualifier (and its source range information) in a new
subclass of MemberExpr called CXXQualifiedMemberExpr. Provide
construction, transformation, profiling, printing, etc., for this new
expression type.

When a virtual function is called via a qualified name, don't emit a
virtual call. Instead, call that function directly. Mike, could you
add a CodeGen test for this, too?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80167 91177308-0d34-0410-b5e6-96231b3b80d8
e9f42087aabfdb6b2afc35c7e38ac65da063b409 26-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> update to CXXFunctionalCastExpr to support ir-gen for
type convesions of class objects [class.conv]. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80127 91177308-0d34-0410-b5e6-96231b3b80d8
8478ce6d3f2416a694e39f791655a473c3907d62 16-Aug-2009 Anders Carlsson <andersca@mac.com> Destroy bound temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79196 91177308-0d34-0410-b5e6-96231b3b80d8
f1480eee38b59d15438fb7bc50865ac7c7e22403 14-Aug-2009 Anders Carlsson <andersca@mac.com> Make the CXXDefaultArgExpr constructor protected and add a static Create function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79013 91177308-0d34-0410-b5e6-96231b3b80d8
bd0fb30fa2a039439d1a30a83ea896801394d780 10-Aug-2009 Anders Carlsson <andersca@mac.com> Add a CastInfo struct that will be used for cast information when constructing cast expressions. Right now it only stores the cast kind, but in the future it might store conversion functions and constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78599 91177308-0d34-0410-b5e6-96231b3b80d8
d497206844a894a0557e927adf29b34fe960dffd 08-Aug-2009 Anders Carlsson <andersca@mac.com> Get rid of Stmt::Clone now that we can reference count statements instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78452 91177308-0d34-0410-b5e6-96231b3b80d8
42602bb40aefcc2751d4078ba88aacf4d965c9bd 07-Aug-2009 Douglas Gregor <dgregor@apple.com> Separate Stmt::Destroy into the entrypoint for destroying a statement
or expression (Destroy) from the virtual function used to actually
destroy a given expression (DoDestroy).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78375 91177308-0d34-0410-b5e6-96231b3b80d8
2eeed7bc4fd457ac57ff32ab3b02674588545f65 05-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> Support for use of default argument in constructors.
work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78132 91177308-0d34-0410-b5e6-96231b3b80d8
cdef2b75aa60cde1ca00e0aa3f89139ac89c6ae4 31-Jul-2009 Anders Carlsson <andersca@mac.com> Add a CastKind enum to CastExpr. Right now it's not used for much but it will be :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77650 91177308-0d34-0410-b5e6-96231b3b80d8
6217b80b7a1379b74cced1c076338262c3c980b3 29-Jul-2009 Ted Kremenek <kremenek@apple.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
5e03f9ea8174ae588c5e69ec6b5ef4c68f8fd766 24-Jul-2009 Douglas Gregor <dgregor@apple.com> This patch fixes the implementations of the __has_trivial_destructor
and __has_trivial_constructor builtin pseudo-functions and
additionally implements __has_trivial_copy and __has_trivial_assign,
from John McCall!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76916 91177308-0d34-0410-b5e6-96231b3b80d8
35366a67baa970c287c714c957cf78a4131cf60d 17-Jul-2009 Ted Kremenek <kremenek@apple.com> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
1a1a6e2bd4c5aefd7fd643cf25915f9623a02e59 16-Jul-2009 Ted Kremenek <kremenek@apple.com> 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

Along with this patch:

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76098 91177308-0d34-0410-b5e6-96231b3b80d8
ba0a9006dbc4814e1e35f82812cb5a1dad65e8b8 14-Jul-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write a CXXOperatorCallExpr from/to PCH files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75598 91177308-0d34-0410-b5e6-96231b3b80d8
9b31df4acdeeb61bb084a03fc37bc5bd570a659e 09-Jul-2009 Anders Carlsson <andersca@mac.com> Store the isAddressOfOperand in the UnresolvedDeclRefExpr, so that we can pass it when instantiating the expr. Fixes another member pointer bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75075 91177308-0d34-0410-b5e6-96231b3b80d8
edce4dd44732dfad69f28822dddcf2b8e92b4483 01-Jul-2009 Douglas Gregor <dgregor@apple.com> Preliminary parsing and ASTs for template-ids that refer to function
templates, such as make<int&>. These template-ids are only barely
functional for function calls; much more to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74563 91177308-0d34-0410-b5e6-96231b3b80d8
f54741e6465692d3bdbae974ac3beeeab92e4a95 16-Jun-2009 Anders Carlsson <andersca@mac.com> Handle temporaries in default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73462 91177308-0d34-0410-b5e6-96231b3b80d8
99ba36de0d5b34624e74e77bffa73929617976cb 05-Jun-2009 Anders Carlsson <andersca@mac.com> Improvements to CXXExprWithTemporaries in preparation for fixing a bug with default arguments that have temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72944 91177308-0d34-0410-b5e6-96231b3b80d8
f0721fe438d7e40c168e5d664970e7830bc138fb 31-May-2009 Anders Carlsson <andersca@mac.com> Add more getters to the new AST nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72651 91177308-0d34-0410-b5e6-96231b3b80d8
88eaf075c56672761b72cc50957db4a35bf24ebd 31-May-2009 Anders Carlsson <andersca@mac.com> Clean up the newly added C++ AST nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72643 91177308-0d34-0410-b5e6-96231b3b80d8
ff6b3d64c9f07155f1414411b8451d7bf8937c62 30-May-2009 Anders Carlsson <andersca@mac.com> Stop using CXXTempVarDecl and use CXXTemporary instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72634 91177308-0d34-0410-b5e6-96231b3b80d8
8e587a15da6d3457a418239d5eb4146fcbd209f3 30-May-2009 Anders Carlsson <andersca@mac.com> Remove VarDecl from CXXConstructExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72633 91177308-0d34-0410-b5e6-96231b3b80d8
b859f35459ae3e1188d1e1b86df08d649695fd86 30-May-2009 Anders Carlsson <andersca@mac.com> Small fixes to CXXTemporary and CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72628 91177308-0d34-0410-b5e6-96231b3b80d8
fceb0a8adba9d25db99a4d73e9655c2831a96ecd 30-May-2009 Anders Carlsson <andersca@mac.com> Add a CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72627 91177308-0d34-0410-b5e6-96231b3b80d8
c1ce477119fed070299668aab24084b17ff5f14b 30-May-2009 Anders Carlsson <andersca@mac.com> Add a CXXTemporary class. Not used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72626 91177308-0d34-0410-b5e6-96231b3b80d8
1c0ca59416999129d0439c2661d137ef38e86209 22-May-2009 Douglas Gregor <dgregor@apple.com> Representation of and template instantiation for member
expressions. This change introduces another AST node,
CXXUnresolvedMemberExpr, that captures member references (x->m, x.m)
when the base of the expression (the "x") is type-dependent, and we
therefore cannot resolve the member reference yet.

Note that our parsing of member references for C++ is still quite
poor, e.g., we don't handle x->Base::m or x->operator int.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72281 91177308-0d34-0410-b5e6-96231b3b80d8
42e5b50f4dc897f252e0d476063a7f9846d96624 21-May-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for C++ throw expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72217 91177308-0d34-0410-b5e6-96231b3b80d8
d94546a0a1deef7286c13e49b9584621ae81cc9a 20-May-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for the various kinds of AST nodes that occur
due to C++ type construction of the form T(a1, a2, ..., aN).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72183 91177308-0d34-0410-b5e6-96231b3b80d8
d81e6ca6e378c3996a139066a5c4b7fc1869630c 20-May-2009 Douglas Gregor <dgregor@apple.com> Introduce a new expression type, CXXUnresolvedConstructExpr, to
describe the construction of a value of a given type using function
syntax, e.g.,

T(a1, a2, ..., aN)

when the type or any of its arguments are type-dependent. In this
case, we don't know what kind of type-construction this will be: it
might construct a temporary of type 'T' (which might be a class or
non-class type) or might perform a conversion to type 'T'. Also,
implement printing of and template instantiation for this new
expression type. Due to the change in Sema::ActOnCXXTypeConstructExpr,
our existing tests cover template instantiation of this new expression

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72176 91177308-0d34-0410-b5e6-96231b3b80d8
a3a7b8eea87c90a5a257f685749222b212ddaf36 19-May-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for cast expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72119 91177308-0d34-0410-b5e6-96231b3b80d8
4a2487aeacf9f35ce553318c2eb39c20ec23845e 19-May-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for call expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72081 91177308-0d34-0410-b5e6-96231b3b80d8
8b0b475b3464b0f70b91ba7d679d23c424677d5e 16-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement instantiation of a few boring, simple expressions. I don't think these are testable yet, though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71953 91177308-0d34-0410-b5e6-96231b3b80d8
4a2e2041edc63db687677325e113b39b9d123c40 15-May-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for WhileStmt and CXXConditionDeclExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71896 91177308-0d34-0410-b5e6-96231b3b80d8
6e8ed16ffef02b82995a90bdcf10ffff7d63839a 10-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement C++0x nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71405 91177308-0d34-0410-b5e6-96231b3b80d8
2d44e8a41de8a33c0f04ac198714f71dc841bab0 02-May-2009 Anders Carlsson <andersca@mac.com> Rename CXXExprWithCleanup to CXXExprWithTemporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70584 91177308-0d34-0410-b5e6-96231b3b80d8
02bbfa33590dfe3107e801fb526b7ab0bdfd00ee 25-Apr-2009 Anders Carlsson <andersca@mac.com> Add CXXExprWithCleanup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70000 91177308-0d34-0410-b5e6-96231b3b80d8
524fa13fd81e88533c7a1d4b1232c0de2c97dc7c 24-Apr-2009 Anders Carlsson <andersca@mac.com> Make CXXTemporaryObjectExpr inherit from CXXConstructExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69981 91177308-0d34-0410-b5e6-96231b3b80d8
09c4abb1057f0eb53a9c2b5c2f22b1472362156e 24-Apr-2009 Anders Carlsson <andersca@mac.com> Add an ASTContext parameter to CXXTemporaryObjectExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69959 91177308-0d34-0410-b5e6-96231b3b80d8
26de54983e7977fad615c94012f2f67d0d1cf404 24-Apr-2009 Anders Carlsson <andersca@mac.com> Add a VarDecl parameter to the CXXTemporaryObjectExpr constructor. It's unused for now, so no functionality change yet. Also, create CXXTempVarDecls to pass to the CXXTemporaryObjectExpr ctor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69957 91177308-0d34-0410-b5e6-96231b3b80d8
bd6734e5f6432ce0cc07171c490ffaa094796198 24-Apr-2009 Anders Carlsson <andersca@mac.com> Make the CXXConstructExpr public and add a StmtClass to it. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69954 91177308-0d34-0410-b5e6-96231b3b80d8
15ef2b5820f9daccc44b9e847163b705b6f5863b 24-Apr-2009 Anders Carlsson <andersca@mac.com> Move the CXXConstructExpr before the CXXTemporaryObjectExpr so that the temporary object expr can inherit from the construct expr. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69953 91177308-0d34-0410-b5e6-96231b3b80d8
e349bea668622ef31bd51a229960a73d69940709 23-Apr-2009 Anders Carlsson <andersca@mac.com> Add a CXXConstructExpr that represents an implicit call to a C++ constructor. I think CXXTemporaryObjectExpr is going to become a subclass of CXXConstructExpr, since CXXTemporaryObjectExpr represents a syntactic temporary, for example T()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69854 91177308-0d34-0410-b5e6-96231b3b80d8
370187c8a3e96517c943329f2511737a04b85450 22-Apr-2009 Douglas Gregor <dgregor@apple.com> Remove the serialization code that predates precompiled
headers. Future approaches to (de-)serializing ASTs will be based on
the PCH infrastructure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69828 91177308-0d34-0410-b5e6-96231b3b80d8
19d28a650ca6d98f7907ad891557fccca7baaea8 21-Apr-2009 Anders Carlsson <andersca@mac.com> Add a CXXDestroyExpr. Add classof member functions to CXXTempVarDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69654 91177308-0d34-0410-b5e6-96231b3b80d8
d87a5012d174ae5aa076b3fa800aecf55d70bac4 17-Apr-2009 Anders Carlsson <andersca@mac.com> Add constructor getter to CXXTemporaryObjectExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69327 91177308-0d34-0410-b5e6-96231b3b80d8
ab452ba8323d1985e08bade2bced588cddf2cc28 27-Mar-2009 Douglas Gregor <dgregor@apple.com> Revamp our representation of C++ nested-name-specifiers. We now have a
uniqued representation that should both save some memory and make it
far easier to properly build canonical types for types involving
dependent nested-name-specifiers, e.g., "typename T::Nested::type".

This approach will greatly simplify the representation of
CXXScopeSpec. That'll be next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67799 91177308-0d34-0410-b5e6-96231b3b80d8
5953d8b37f92f0cf548941f617c9b0a7703df33b 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Introduce a new expression type, UnresolvedDeclRefExpr, that describes
dependent qualified-ids such as

Fibonacci<N - 1>::value

where N is a template parameter. These references are "unresolved"
because the name is dependent and, therefore, cannot be resolved to a
declaration node (as we would do for a DeclRefExpr or
QualifiedDeclRefExpr). UnresolvedDeclRefExprs instantiate to
DeclRefExprs, QualifiedDeclRefExprs, etc.

Also, be a bit more careful about keeping only a single set of
specializations for a class template, and instantiating from the
definition of that template rather than a previous declaration. In
general, we need a better solution for this for all TagDecls, because
it's too easy to accidentally look at a declaration that isn't the

We can now process a simple Fibonacci computation described as a
template metaprogram.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67308 91177308-0d34-0410-b5e6-96231b3b80d8
bad351822117eaf280081494e3dbe4a06c0dbfcf 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Generalize printing of nested-name-specifier sequences for use in both
QualifiedNameType and QualifiedDeclRefExpr. We now keep track of the
exact nested-name-specifier spelling for a QualifiedDeclRefExpr, and
use that spelling when printing ASTs. This fixes PR3493.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67283 91177308-0d34-0410-b5e6-96231b3b80d8
ba49817c5b9f502602672861cf369fd0e53966e8 13-Mar-2009 Douglas Gregor <dgregor@apple.com> Implement template instantiation for several more kinds of expressions:
- C++ function casts, e.g., T(foo)
- sizeof(), alignof()

More importantly, this allows us to verify that we're performing
overload resolution during template instantiation, with
argument-dependent lookup and the "cached" results of name lookup from
the template definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66947 91177308-0d34-0410-b5e6-96231b3b80d8
063daf6e196c51f162e0485478355d8e280eef5c 13-Mar-2009 Douglas Gregor <dgregor@apple.com> Refactor the way we handle operator overloading and template
instantiation for binary operators. This change moves most of the
operator-overloading code from the parser action ActOnBinOp to a new,
parser-independent semantic checking routine CreateOverloadedBinOp.

Of particular importance is the fact that CreateOverloadedBinOp does
*not* perform any name lookup based on the current parsing context (it
doesn't take a Scope*), since it has to be usable during template
instantiation, when there is no scope information. Rather, it takes a
pre-computed set of functions that are visible from the context or via
argument-dependent lookup, and adds to that set any member operators
and built-in operator candidates. The set of functions is computed in
the parser action ActOnBinOp based on the current context (both
operator name lookup and argument-dependent lookup). Within a
template, the set computed by ActOnBinOp is saved within the
type-dependent AST node and is augmented with the results of
argument-dependent name lookup at instantiation time (see

Sadly, we can't fully test this yet. I'll follow up with template
instantiation for sizeof so that the real fun can begin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66923 91177308-0d34-0410-b5e6-96231b3b80d8
3fd95ce225393fe4a3623e429766a8c3f487ff9d 13-Mar-2009 Douglas Gregor <dgregor@apple.com> Improve the representation of operator expressions like "x + y" within
C++ templates. In particular, keep track of the overloaded operators
that are visible from the template definition, so that they can be
merged with those operators visible via argument-dependent lookup at
instantiation time.

Refactored the lookup routines for argument-dependent lookup and for
operator name lookup, so they can be called without immediately adding
the results to an overload set.

Instantiation of these expressions is completely wrong. I'll work on
that next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66851 91177308-0d34-0410-b5e6-96231b3b80d8
2850784bda09416fc7e9d57f5baa36c9351c757c 26-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make more AST nodes and semantic checkers dependent-expression-aware.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65529 91177308-0d34-0410-b5e6-96231b3b80d8
c87a282e7b80c055088fc51bdbe8fc73da64d4f8 18-Feb-2009 Daniel Dunbar <daniel@zuster.org> Rename UnaryTypeTraitExpr::Evaluate to EvaluateTrait to not collide
with Expr::Evaluate().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64850 91177308-0d34-0410-b5e6-96231b3b80d8
668bf91d31265b6ea8c3eb854ba450857701f269 09-Feb-2009 Ted Kremenek <kremenek@apple.com> CallExpr now uses ASTContext's allocate to allocate/delete its array of subexpressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64162 91177308-0d34-0410-b5e6-96231b3b80d8
17330019f05966762bc952840ef1926b9becb145 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Fix our semantic analysis of

unqualified-id '('

in C++. The unqualified-id might not refer to any declaration in our
current scope, but declarations by that name might be found via
argument-dependent lookup. We now do so properly.

As part of this change, CXXDependentNameExpr, which was previously
designed to express the unqualified-id in the above constructor within
templates, has become UnresolvedFunctionNameExpr, which does
effectively the same thing but will work for both templates and

Additionally, we cope with all unqualified-ids, since ADL also applies
in cases like

operator+(x, y)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63733 91177308-0d34-0410-b5e6-96231b3b80d8
4c67834407ca6ab344dcf44fc599ad4938cfa96d 28-Jan-2009 Douglas Gregor <dgregor@apple.com> Code generation support for C99 designated initializers.

The approach I've taken in this patch is relatively straightforward,
although the code itself is non-trivial. Essentially, as we process
an initializer list we build up a fully-explicit representation of the
initializer list, where each of the subobject initializations occurs
in order. Designators serve to "fill in" subobject initializations in
a non-linear way. The fully-explicit representation makes initializer
lists (both with and without designators) easy to grok for codegen and
later semantic analyses. We keep the syntactic form of the initializer
list linked into the AST for those clients interested in exactly what
the user wrote.

Known limitations:
- Designating a member of a union that isn't the first member may
result in bogus initialization (we warn about this)
- GNU array-range designators are not supported (we warn about this)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63242 91177308-0d34-0410-b5e6-96231b3b80d8
506ae418eb171d072f2fb4f6bc46d258b52cbf97 16-Jan-2009 Douglas Gregor <dgregor@apple.com> Part one of handling C++ functional casts. This handles semantic
analysis and AST-building for the cases where we have N != 1
arguments. For N == 1 arguments, we need to finish the C++
implementation of explicit type casts (C++ [expr.cast]).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62329 91177308-0d34-0410-b5e6-96231b3b80d8
1a49af9681c350fef58e677f85ccb9a77e8e9d0a 06-Jan-2009 Douglas Gregor <dgregor@apple.com> Add QualifiedDeclRefExpr, which retains additional source-location
information for declarations that were referenced via a qualified-id,
e.g., N::C::value. We keep track of the location of the start of the
nested-name-specifier. Note that the difference between
QualifiedDeclRefExpr and DeclRefExpr does have an effect on the
semantics of function calls in two ways:
1) The use of a qualified-id instead of an unqualified-id suppresses
argument-dependent lookup
2) If the name refers to a virtual function, the qualified-id
version will call the function determined statically while the
unqualified-id version will call the function determined dynamically
(by looking up the appropriate function in the vtable).

Neither of these features is implemented yet, but we do print out
qualified names for QualifiedDeclRefExprs as part of the AST printing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61789 91177308-0d34-0410-b5e6-96231b3b80d8
64b45f7e0d3167f040841ac2920aead7f080730d 05-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> PODness and Type Traits

Make C++ classes track the POD property (C++ [class]p4)
Track the existence of a copy assignment operator.
Implicitly declare the copy assignment operator if none is provided.
Implement most of the parsing job for the G++ type traits extension.
Fully implement the low-hanging fruit of the type traits:
__is_pod: Whether a type is a POD.
__is_class: Whether a type is a (non-union) class.
__is_union: Whether a type is a union.
__is_enum: Whether a type is an enum.
__is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61746 91177308-0d34-0410-b5e6-96231b3b80d8
61366e9cd41a6dbde4e66416dac21269c8ac1d94 24-Dec-2008 Douglas Gregor <dgregor@apple.com> Correct the order in which we cope with end-of-class-definition
semantics and improve our handling of default arguments. Specifically,
we follow this order:

- As soon as the see the '}' in the class definition, the class is
complete and we add any implicit declarations (default constructor,
copy constructor, etc.) to the class.
- If there are any default function arguments, parse them
- If there were any inline member function definitions, parse them

As part of this change, we now keep track of the the fact that we've
seen unparsed default function arguments within the AST. See the new
ParmVarDecl::hasUnparsedDefaultArg member. This allows us to properly
cope with calls inside default function arguments to other functions
where we're making use of the default arguments.

Made some C++ error messages regarding failed initializations more

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61406 91177308-0d34-0410-b5e6-96231b3b80d8
88a3514f36de96b19cdf50141c640df1a5f13f6c 22-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for calls to overloaded member functions. Things to note:
- Overloading has to cope with having both static and non-static
member functions in the overload set.
- The call may or may not have an implicit object argument,
depending on the syntax (x.f() vs. f()) and the context (static
vs. non-static member function).
- We now generate MemberExprs for implicit member access expression.
- We now cope with mutable whenever we're building MemberExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61329 91177308-0d34-0410-b5e6-96231b3b80d8
5c37de788529cd9180f22069970737a7208bd625 06-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for calls to dependent names within templates, e.g.,

template<typename T> void f(T x) {
g(x); // g is a dependent name, so don't even bother to look it up
g(); // error: g is not a dependent name

Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.

GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60618 91177308-0d34-0410-b5e6-96231b3b80d8
d457589fc69dc7a9c80cd74d317c0b81a35a27c9 04-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Fix some type punning errors in SizeOfAlignOf and Typeid AST nodes. This should satisfy compilers and language lawyers alike.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60511 91177308-0d34-0410-b5e6-96231b3b80d8
cee63fbf0e64ac526582312bf8cf33263fc5c16e 02-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Handle new by passing the Declaration to the Action, not a processed type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60413 91177308-0d34-0410-b5e6-96231b3b80d8
4c5d320a7581f4b80b151630c91cea5727fa9923 21-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59835 91177308-0d34-0410-b5e6-96231b3b80d8
b4609806e9232593ece09ce08b630836e825865c 14-Nov-2008 Douglas Gregor <dgregor@apple.com> Add a new expression node, CXXOperatorCallExpr, which expresses a
function call created in response to the use of operator syntax that
resolves to an overloaded operator in C++, e.g., "str1 +
str2" that resolves to std::operator+(str1, str2)". We now build a
CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But
only for binary operators, where we actually implement overloading)

I decided *not* to refactor the current CallExpr to make it abstract
(with FunctionCallExpr and CXXOperatorCallExpr as derived
classes). Doing so would allow us to make CXXOperatorCallExpr a little
bit smaller, at the cost of making the argument and callee accessors
virtual. We won't know if this is going to be a win until we can parse
lots of C++ code to determine how much memory we'll save by making
this change vs. the performance penalty due to the extra virtual

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59306 91177308-0d34-0410-b5e6-96231b3b80d8
c42e1183846228a7fa5143ad76507d6d60f5c6f3 11-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement C++ 'typeid' parsing and sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59042 91177308-0d34-0410-b5e6-96231b3b80d8
796da18402f286b897782a298ae3b20c459c102e 04-Nov-2008 Douglas Gregor <dgregor@apple.com> Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary expression. Remove CXXThis from PredefinedExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58695 91177308-0d34-0410-b5e6-96231b3b80d8
9d293dfc0ad7c44ae0b5eb9517f1ed8c8d8b7ff7 28-Oct-2008 Douglas Gregor <dgregor@apple.com> Improve our handling of (C++) references within Clang. Specifically:
- Do not allow expressions to ever have reference type
- Extend Expr::isLvalue to handle more cases where having written a
reference into the source implies that the expression is an lvalue
(e.g., function calls, C++ casts).
- Make GRExprEngine::VisitCall treat the call arguments as lvalues when
they are being bound to a reference parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58306 91177308-0d34-0410-b5e6-96231b3b80d8
49badde06e066d058d6c7fcf4e628a72999b65a9 27-Oct-2008 Douglas Gregor <dgregor@apple.com> Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
- ImplicitCastExpr is (still) used for all explicit casts
- ExplicitCastExpr is now the root of all *explicit* casts
- ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
- CXXFunctionalCastExpr inherits from ExplicitCastExpr
- CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
- Added classes CXXStaticCastExpr, CXXDynamicCastExpr,
CXXReinterpretCastExpr, and CXXConstCastExpr to

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
9e922b1663ecb95dc7eee03002fd66ed18fb3192 10-Sep-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add new 'CXXConditionDeclExpr' expression node used for a 'condition' declaration, e.g: "if (int x=0) {...}".
It is a subclass of DeclRefExpr and the main difference is that CXXConditionDeclExpr owns the declaration that it references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56033 91177308-0d34-0410-b5e6-96231b3b80d8
987a14bf5883ef6e5d07f1c83eb6d41a8212a78c 22-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add support for C++'s "type-specifier ( expression-list )" expression:

-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
-If the type is a class, it will treat it as a class constructor. [TODO]
-If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
-If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55177 91177308-0d34-0410-b5e6-96231b3b80d8
c4a1dea2dc56bd1357ec91b829a0b9e68229a13e 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
- Moved Sema::getCurMethodDecl() out of line (dependent on
ObjCMethodDecl via dyn_cast).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54629 91177308-0d34-0410-b5e6-96231b3b80d8
1060aff23f72135f8b50034a1e80f16725ebc56c 17-Jun-2008 Ted Kremenek <kremenek@apple.com> Fix more strict-aliasing warnings.
Fix indentation of class declarations in ExprCXX.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52380 91177308-0d34-0410-b5e6-96231b3b80d8
9e979557eea3875c9e3d100c68188233dd7f46c0 13-Apr-2008 Chris Lattner <sabre@nondot.org> Default argument cleanups and minor improvements, patch by
Doug Gregor!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49598 91177308-0d34-0410-b5e6-96231b3b80d8
8123a95c33b792d35c2e4992ba6e27882748fb0d 10-Apr-2008 Chris Lattner <sabre@nondot.org> Several improvements from Doug Gregor related to default
argument handling. I'll fix up the c89 (void) thing next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49459 91177308-0d34-0410-b5e6-96231b3b80d8
04421087832a031c90bd58f128c7c0e741db8dd2 08-Apr-2008 Chris Lattner <sabre@nondot.org> Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49369 91177308-0d34-0410-b5e6-96231b3b80d8
50dd289f45738ed22b7583d52ed2525b927042ff 26-Feb-2008 Chris Lattner <sabre@nondot.org> add parsing, ast building and pretty printing support for C++ throw expressions.
Patch by Mike Stump!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47582 91177308-0d34-0410-b5e6-96231b3b80d8
0bc735ffcfb223c0186419547abaa5c84482663e 29-Dec-2007 Chris Lattner <sabre@nondot.org> Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
311ff02fae0392bee6abe7723cdf5a69b2899a47 17-Oct-2007 Chris Lattner <sabre@nondot.org> Add a new Rewriter::getRangeSize method.
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43047 91177308-0d34-0410-b5e6-96231b3b80d8
210679cacc47640107e46090de1a138977a0431e 25-Aug-2007 Steve Naroff <snaroff@apple.com> Give CXXBoolLiteralExpr a type (all expressions need a valid type).

This fixes the following:

******************** TEST 'Parser/cxx-bool.cpp' FAILED! ********************
clang -fsyntax-only Parser/cxx-bool.cpp
SemaExpr.cpp:731: failed assertion `!t.isNull() && "DefaultFunctionArrayConversion - missing type"'
Output/cxx-bool.cpp.out.script: line 1: 22697 Abort trap clang -fsyntax-only Parser/cxx-bool.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41401 91177308-0d34-0410-b5e6-96231b3b80d8
c10d33c01478f2444b2b87aefa090493f028d2d5 24-Aug-2007 Ted Kremenek <kremenek@apple.com> Implemented child_begin/child_end for our current set of C++ expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41368 91177308-0d34-0410-b5e6-96231b3b80d8
c5598cbc4c3f2fb515af7f142f78ff630bdb5c01 21-Aug-2007 Chris Lattner <sabre@nondot.org> Switch StmtVisitor from using dynamic to static dispatch. This makes it
significantly faster and actually reduces the amount of code in the system.
This also allows for future visitor changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41211 91177308-0d34-0410-b5e6-96231b3b80d8
36460eea641bf20a67b8b767b6d26373a90f0965 09-Aug-2007 Chris Lattner <sabre@nondot.org> move a switch to common code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40967 91177308-0d34-0410-b5e6-96231b3b80d8
5f016e2cb5d11daeb237544de1c5d59f20fe1a6e 11-Jul-2007 Reid Spencer <rspencer@reidspencer.com> Stage two of getting CFE top correct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8