History log of /external/clang/include/clang/AST/ASTContext.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
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
b2969b1e50580344891a98f5b241f8351fe371cf 11-Oct-2013 Warren Hunt <whunt@google.com> Adds Microsoft compatiable C++ record layout code to clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192494 91177308-0d34-0410-b5e6-96231b3b80d8
4ed0122c1b795379cc4e11dfd62312358dcbf506 07-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> When merging class definitions across modules in C++, merge together fields.
This change doesn't go all the way to making fields redeclarable; instead, it
makes them 'mergeable', which means we can find the canonical declaration, but
not much else (and for a declaration that's not from a module, the canonical
declaration is always that declaration).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192092 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
1eef85246b411b55c493098266746d0d83c241ea 13-Sep-2013 David Tweed <david.tweed@arm.com> Certain multi-platform languages, such as OpenCL, have the concept of
address spaces which is both (1) a "semantic" concept and
(2) possibly a hardware level restriction. It is desirable to
be able to discard/merge the LLVM-level address spaces on arguments for which
there is no difference to the current backend while keeping
track of the semantic address spaces in a funciton prototype. To do this
enable addition of the address space into the name-mangling process. Add
some tests to document this behaviour against inadvertent changes.

Patch by Michele Scandale!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190684 91177308-0d34-0410-b5e6-96231b3b80d8
942f9fe11d3a9583eef6bc4ca2549b1f0d1694da 10-Sep-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Implement guard variables for static initialization

Static locals requiring initialization are not thread safe on Windows.
Unfortunately, it's possible to create static locals that are actually
externally visible with inline functions and templates. As a result, we
have to implement an initialization guard scheme that is compatible with
TUs built by MSVC, which makes thread safety prohibitively difficult.

MSVC's scheme is that every function that requires a guard gets an i32
bitfield. Each static local is assigned a bit that indicates if it has
been initialized, up to 32 bits, at which point a new bitfield is
created. MSVC rejects inline functions with more than 32 static locals,
and the externally visible mangling (?_B) only allows for one guard
variable per function.

On Eli's recommendation, I used MangleNumberingContext to track which
bit each static corresponds to.

Implements PR16888.

Reviewers: rjmccall, eli.friedman

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190427 91177308-0d34-0410-b5e6-96231b3b80d8
7b7bef1ec355fb46643349d77c266b913f36b656 05-Sep-2013 Stepan Dyatkovskiy <stpworld@narod.ru> Add new methods for TargetInfo:
getRealTypeByWidth and getIntTypeByWidth
for ASTContext names are almost same(invokes new methods from TargetInfo):
getIntTypeForBitwidth and getRealTypeForBitwidth.

As first commit for PR16752 fix: 'mode' attribute for unusual targets doesn't work properly
Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp).
For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only.
Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct.
Please consider the next solution:
1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth virtual methods. By default current behaviour could be implemented here.
2. Fix handleModeAttr according to new methods in TargetInfo.
This approach is implemented in the patch attached to this post.

1st Commit (Current): Add new methods for TargetInfo:
getRealTypeByWidth and getIntTypeByWidth
for ASTContext names are almost same(invokes new methods from TargetInfo):
getIntTypeForBitwidth and getRealTypeForBitwidth

2nd Commit (Next): Fix SemaDeclAttr, handleModeAttr function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190044 91177308-0d34-0410-b5e6-96231b3b80d8
cd03f862d82cac28c9517e2036716f8d49112c8b 30-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Be lazier when loading KeyFunctions from PCH/modules. We don't need to load
these in eagerly if we're not actually processing a translation unit. The added
laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an
upcoming class template specialization merging patch would like.

Ideally, we should mark the vtable as used when we see a definition for the key
function, rather than having a separate pass over dynamic classes at the end of
the TU. The existing approach is pretty bad for PCH/modules, since it forcibly
loads the declarations of all key functions in all imported modules, whether or
not those key functions are defined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189627 91177308-0d34-0410-b5e6-96231b3b80d8
ef072033876e295ec5d3402f8730a3ae358ad815 28-Aug-2013 Reid Kleckner <reid@kleckner.net> Delete CC_Default and use the target default CC everywhere

Makes functions with implicit calling convention compatible with
function types with a matching explicit calling convention. This fixes
things like calls to qsort(), which has an explicit __cdecl attribute on
the comparator in Windows headers.

Clang will now infer the calling convention from the declarator. There
are two cases when the CC must be adjusted during redeclaration:
1. When defining a non-inline static method.
2. When redeclaring a function with an implicit or mismatched

Fixes PR13457, and allows clang to compile CommandLine.cpp for the
Microsoft C++ ABI.

Excellent test cases provided by Alexander Zinenko!

Reviewers: rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189412 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
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
1c56c9d9c2eed9ade88afe93541cc6fd25932355 08-Aug-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix alignof computation of large arrays on x86_64.

We were exposing the extra alignment given to large arrays. The new behavior
matches gcc, which is a good thing since this is a gcc extension.

Thanks to Joerg Sonnenberger for noticing it.

While at it, centralize the method description in the .h file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187999 91177308-0d34-0410-b5e6-96231b3b80d8
ef4579cda09b73e3d4d98af48201da25adc29326 06-Aug-2013 Larisse Voufo <lvoufo@google.com> Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187762 91177308-0d34-0410-b5e6-96231b3b80d8
ad4aaf11897cc5e9d443b0a80114daacf385f6df 15-Jul-2013 Fariborz Jahanian <fjahanian@apple.com> ObjC migrator: finding conforming protocol
candidates for each class. wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186349 91177308-0d34-0410-b5e6-96231b3b80d8
5e867c8a07d82da0d3b0a43402ee4f1c6ba416e9 10-Jul-2013 Eli Friedman <eli.friedman@gmail.com> More local mangling fixes.

Compute mangling numbers for externally visible local variables and tags.
Change the mangler to consistently use discriminators where necessary.
Tweak the scheme we use to number decls which are not externally visible
to avoid unnecessary discriminators in common cases now that we request
them more consistently.

Fixes <rdar://problem/14204721>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185986 91177308-0d34-0410-b5e6-96231b3b80d8
07369dde9d72213bf8a48288cd8b29999af9a40c 01-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix mangling for block literals.

Blocks, like lambdas, can be written in contexts which are required to be
treated as the same under ODR. Unlike lambdas, it isn't possible to actually
take the address of a block, so the mangling of the block itself doesn't
matter. However, objects like static variables inside a block do need to
be mangled in a consistent way.

There are basically three components here. One, block literals need a
consistent numbering. Two, objects/types inside a block literal need
to be mangled using it. Three, objects/types inside a block literal need
to have their linkage computed correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185372 91177308-0d34-0410-b5e6-96231b3b80d8
0a598fd7e428b5eb28b67770a66f3976ac365e42 27-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Delete dead code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185101 91177308-0d34-0410-b5e6-96231b3b80d8
cd06f26835033e879a9278941f4f6e6a4086976d 26-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Rewrite record layout for ms_struct structs.

The old implementation of ms_struct in RecordLayoutBuilder was a
complete mess: it depended on complicated conditionals which didn't
really reflect the underlying logic, and placed a burden on users of
the resulting RecordLayout. This commit rips out almost all of the
old code, and replaces it with simple checks in

This commit also fixes <rdar://problem/14252115>, a bug where class
inheritance would cause us to lay out bitfields incorrectly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185018 91177308-0d34-0410-b5e6-96231b3b80d8
12df246d6dea2ee1f92c186f922f1afcf499647a 24-Jun-2013 Reid Kleckner <reid@kleckner.net> [AST] Introduce a new DecayedType sugar node

The goal of this sugar node is to be able to look at an arbitrary
FunctionType and tell if any of the parameters were decayed from an
array or function type. Ultimately this is necessary to implement
Microsoft's C++ name mangling scheme, which mangles decayed arrays
differently from normal pointers.

Reviewers: rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184763 91177308-0d34-0410-b5e6-96231b3b80d8
cac18add73d095eaab600aefe27ea7174aec4922 20-Jun-2013 Nico Weber <nicolasweber@gmx.de> Lazily provide a __float128 dummy type in -std=gnu++11 mode.

This is needed to parse libstdc++ 4.7's type_traits, see PR13530.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184476 91177308-0d34-0410-b5e6-96231b3b80d8
6b96742ceedebb5eb8f1299ab67cb3ecd6d92aaf 17-Jun-2013 Reid Kleckner <reid@kleckner.net> Try to fix the bots with a forward decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184077 91177308-0d34-0410-b5e6-96231b3b80d8
cff15128c6c089bd6fae841b80680e6f5afbf0bf 17-Jun-2013 Reid Kleckner <reid@kleckner.net> [AST] Don't include RecursiveASTVisitor.h in ASTContext.h

The untemplated implementation of getParents() doesn't need to be in a
header file.

RecursiveASTVisitor.h is full of repeated macro expansion. Moving this
include to ASTContext.cpp speeds up compilation of
LambdaMangleContext.cpp, a small C++ file with few includes, from 3.7s
to 2.8s for me locally. I haven't measured a full build, but it can't

I had to fix a few static analyzer files that were depending on
transitive includes of C++ AST headers.

Reviewers: rsmith, klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184075 91177308-0d34-0410-b5e6-96231b3b80d8
605c59a1d1a11112c643031770c616e2e441c349 11-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Make ASTContext::Allocate use size_t for the size argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183757 91177308-0d34-0410-b5e6-96231b3b80d8
c910d4cfa5042f2c9da1eb4e0b6ed59240c0eeee 08-Jun-2013 Reid Kleckner <reid@kleckner.net> Revert "[Sema] Make FunctionType's TSI use unadjusted argument types"

This reverts commit r183614.

It broke test/Sema/block-printf-attribute-1.c on non-Windows platforms,
and the fix is not trivial.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183616 91177308-0d34-0410-b5e6-96231b3b80d8
63c9a92a805394c1ca9e4a5fd8afb3acbb918d03 08-Jun-2013 Reid Kleckner <reid@kleckner.net> [Sema] Make FunctionType's TSI use unadjusted argument types

This helps preserve the type-as-written in the AST, which we need for
MSVC mangling. In particular, we need to preserve the types of array
parameters in function pointer types.

The essence of this change is:
- QualType ArgTy = Param->getType();
+ QualType ArgTy = Param->getTypeSourceInfo()->getType();

... followed by the adjustment in ActOnFunctionDeclarator().

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183614 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
f0f353b36f173ea282209070fcdbbedab84c19db 03-Jun-2013 Manuel Klimek <klimek@google.com> Fix memory leak for APValues that do memory allocation.

This patch ensures that APValues are deallocated with the ASTContext by
registering a deallocation function for APValues to the ASTContext.

Original version of the patch by James Dennett.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183101 91177308-0d34-0410-b5e6-96231b3b80d8
42b7861f957591ab40128419dcef0fae081364d6 29-May-2013 Rafael Espindola <rafael.espindola@gmail.com> Remove unused field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182874 91177308-0d34-0410-b5e6-96231b3b80d8
538bbe597b935a74d95c668ad209536753f13481 28-May-2013 Fariborz Jahanian <fjahanian@apple.com> Patch to issue error when target of MacOS and iOS
does not support large load/store of atomic objects.
// rdar://13973577

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182781 91177308-0d34-0410-b5e6-96231b3b80d8
0a74a4ccc4ecfe1a2792ab72c83815323d8fc914 21-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> In -ast-dump, only dump comments when dumping the actual Decl to which they
attach, rather than merging all comments on the declaration chain. This gives a
more faithful dump, and has the side benefit of unbreaking uses of dump() from
within AST deserialization (where the redeclaration chain may not be sane).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182350 91177308-0d34-0410-b5e6-96231b3b80d8
15f92bad58c8650b1306729744b1a1230197497a 10-May-2013 Hans Wennborg <hans@hanshq.net> Add support for __wchar_t in -fms-extensions mode.

MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.

The commit changes ASTContext to have two different types for this:

- WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.

- WideCharTy is the type of a wide character literal. In C++ this is
the same as WCharTy, and in C it is an integer type compatible with
the type in <stddef.h>.

This fixes PR15815.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181587 91177308-0d34-0410-b5e6-96231b3b80d8
6b20351a1d6178addfaa86716aaba36f2e9ea188 06-May-2013 Ulrich Weigand <ulrich.weigand@de.ibm.com> Allow targets to define minimum alignment for global variables

This patch adds a new common code feature that allows platform code to
request minimum alignment of global symbols. The background for this is
that on SystemZ, the most efficient way to load addresses of global symbol
is the LOAD ADDRESS RELATIVE LONG (LARL) instruction. This instruction
provides PC-relative addressing, but only to *even* addresses. For this
reason, existing compilers will guarantee that global symbols are always
aligned to at least 2. [ Since symbols would otherwise already use a
default alignment based on their type, this will usually only affect global
objects of character type or character arrays. ] GCC also allows creating
symbols without that extra alignment by using explicit "aligned" attributes
(which then need to be used on both definition and each use of the symbol).

To enable support for this with Clang, this patch adds a
TargetInfo::MinGlobalAlign variable that provides a global minimum for the
alignment of every global object (unless overridden via explicit alignment
attribute), and adds code to respect this setting. Within this patch, no
platform actually sets the value to anything but the default 1, resulting
in no change in behaviour on any existing target.

This version of the patch incorporates feedback from reviews by
Eric Christopher and John McCall. Thanks to all reviewers!

Patch by Richard Sandiford.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181210 91177308-0d34-0410-b5e6-96231b3b80d8
60e141e1f87211ca831de6821003d80fe20a06f3 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement most of N3638 (return type deduction for normal functions).
Missing (somewhat ironically) is support for the new deduction rules
in lambda functions, plus PCH support for return type patching.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
a3ae52b63aff9d4478084e40b1f683f45eb06ab7 01-May-2013 Fariborz Jahanian <fjahanian@apple.com> [documenting declaration]: Remove arc liftime qualifiers
when doccumenting declrations in comments.
// rdar://13757500

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180880 91177308-0d34-0410-b5e6-96231b3b80d8
dc7a4f5d7a7e3b60d4dc4a80338d7a2728540998 30-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't treat a non-deduced 'auto' type as being type-dependent. Instead, there
are now two distinct canonical 'AutoType's: one is the undeduced 'auto'
placeholder type, and the other is a deduced-but-dependent type. All
deduced-to-a-non-dependent-type cases are still non-canonical.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180789 91177308-0d34-0410-b5e6-96231b3b80d8
a2c3646c35dd09d21b74826240aa916545b1873f 26-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++1y decltype(auto).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180610 91177308-0d34-0410-b5e6-96231b3b80d8
77670f17ae3a5c3188149c19a7e386c01d0aa7c0 15-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert "Speed-up ObjCMethodDecl::getOverriddenMethods()."

This reverts commit r179436.

Due to caching, it was possible that we could miss overridden methods that
were introduced by categories later on.

Along with reverting the commit I also included a test case that would have caught this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179547 91177308-0d34-0410-b5e6-96231b3b80d8
175c8e2e57befe2db15dd339ab5eb27d0c2b6013 13-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Speed-up ObjCMethodDecl::getOverriddenMethods().

Use an newly introduce ASTContext::getBaseObjCCategoriesAfterInterface() which caches its
results instead of re-calculating the categories multiple times.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179436 91177308-0d34-0410-b5e6-96231b3b80d8
bea522ff43a3f11c7a2bc7949119dbb9fce19e39 08-Mar-2013 Jordan Rose <jordan_rose@apple.com> ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.

No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176726 91177308-0d34-0410-b5e6-96231b3b80d8
ff9a01000ff74a994aa3da26ea2ec732c97291b7 28-Feb-2013 Manuel Klimek <klimek@google.com> First step towards adding a parent map to the ASTContext.

This does not yet implement the LimitNode approach discussed.

The impact of this is an O(n) in the number of nodes in the AST
reduction of complexity for certain kinds of matchers (as otherwise the
parent map gets recreated for every new MatchFinder).

See FIXMEs in the comments for the direction of future work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176251 91177308-0d34-0410-b5e6-96231b3b80d8
f512acee01617c9da8079ed88ded3bb9f2418349 22-Feb-2013 Benjamin Kramer <benny.kra@googlemail.com> Replace some typically large vectors with SmallVector.

This may seem counter-intuitive but the POD-like optimization helps when the
vectors grow into multimegabyte buffers. SmallVector calls realloc which knows
how to twiddle virtual memory bits and avoids large copies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175906 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
0076ea62c2da91121bca6d402da67f0b611fc8bb 16-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove unused forward declarations

clang/AST/Decl.h is included to see the TypeSourceInfo definition anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175332 91177308-0d34-0410-b5e6-96231b3b80d8
17c1a2e748d49d293c9926eeeb85aa4890182106 15-Feb-2013 Fariborz Jahanian <fjahanian@apple.com> objective-C: Fixes a compiler crash when encoding
an ivar of type pointer to a typedef'ed object.
// rdar://13190095

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175298 91177308-0d34-0410-b5e6-96231b3b80d8
21f18c4fda167dc5f72feddbd6a7ac1b63200a0d 07-Feb-2013 Guy Benyei <guy.benyei@intel.com> Add OpenCL samplers as Clang builtin types and check sampler related restrictions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174601 91177308-0d34-0410-b5e6-96231b3b80d8
b35cc2d46c4188a0b2d094b3104ce69092c34802 03-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Constify ASTContext::getObjContainingInterface

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174282 91177308-0d34-0410-b5e6-96231b3b80d8
9677eb864f7354f140cd1bf59557843851e65de4 26-Jan-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Added ASTContext methods getIntPtrType and getUIntPtrType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173581 91177308-0d34-0410-b5e6-96231b3b80d8
d5617eeafc93209a26b9f88276c88cf997c3a0a7 25-Jan-2013 John McCall <rjmccall@apple.com> The standard ARM C++ ABI dictates that inline functions are
never key functions. We did not implement that rule for the
iOS ABI, which was driven by what was implemented in gcc-4.2.
However, implement it now for other ARM-based platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173515 91177308-0d34-0410-b5e6-96231b3b80d8
e6b9d802fb7b16d93474c4f1c179ab36202e8a8b 20-Jan-2013 Guy Benyei <guy.benyei@intel.com> Implement OpenCL event_t as Clang builtin type, including event_t related OpenCL restrictions (OpenCL 1.2 spec 6.9)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172973 91177308-0d34-0410-b5e6-96231b3b80d8
f7992132207d7ddc8810a135cec97ebe5805e500 04-Jan-2013 Fariborz Jahanian <fjahanian@apple.com> Fix up various builtin declaration of objc_msgSend families
to match those foung in objc.h an avoid spurious warnings.
// rdar://12489098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171492 91177308-0d34-0410-b5e6-96231b3b80d8
b13621d08e20ac7aa550e05896de8a57ee99c1e8 18-Dec-2012 Guy Benyei <guy.benyei@intel.com> Re-commit r170428 changes with Linux style file endings.

Add OpenCL images as clang builtin types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170432 91177308-0d34-0410-b5e6-96231b3b80d8
7f92f2d8d9b7a07900c030183bc13a9ff60057cc 18-Dec-2012 Guy Benyei <guy.benyei@intel.com> Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170431 91177308-0d34-0410-b5e6-96231b3b80d8
736104a7619c53ef92553780273d7357a3cdde81 18-Dec-2012 Guy Benyei <guy.benyei@intel.com> Add OpenCL images as clang builtin types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170428 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
b15c8984ea300624fbbde385d3907667ce1043fa 29-Nov-2012 Fariborz Jahanian <fjahanian@apple.com> objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168825 91177308-0d34-0410-b5e6-96231b3b80d8
6902e4146d426998ff6a94b16776c1b3f805a048 27-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Fix the definition of the vfork() builtin on Haiku. PR14378.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168674 91177308-0d34-0410-b5e6-96231b3b80d8
3ca23d7dc6cb61e6f363a58d9256d548199d120c 14-Nov-2012 Fariborz Jahanian <fjahanian@apple.com> objective-C blocks: Provide layout map for byref
variables captured in a block. // rdar://12184410

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167931 91177308-0d34-0410-b5e6-96231b3b80d8
66cff7257698d5528632917d38f9a3037bb1506d 14-Nov-2012 David Blaikie <dblaikie@gmail.com> Provide the correct mangling and linkage for certain unnamed nested classes.

This corrects the mangling and linkage of classes (& their member functions) in
cases like this:

struct foo {
struct {
void func() { ... }
} x;

we were accidentally giving this nested unnamed struct 'no' linkage where it
should've had the linkage of the outer class. The mangling was incorrecty too,
mangling as TU-wide unnamed type mangling of $_X rather than class-scoped
mangling of UtX_.

This also fixes -Wunused-member-function which would incorrectly diagnose
'func' as unused due to it having no linkage & thus appearing to be TU-local
when in fact it might be correctly used in another TU.

Similar mangling should be applied to function local classes in similar cases
but I've deferred that for a subsequent patch.

Review/discussion by Richard Smith, John McCall, & especially Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167906 91177308-0d34-0410-b5e6-96231b3b80d8
1e905da74dbfd353d77dfc548fc9d6ff420d515a 03-Nov-2012 Dmitri Gribenko <gribozavr@gmail.com> Remove a const_cast by propagating constness to the member function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167357 91177308-0d34-0410-b5e6-96231b3b80d8
749ace614b6ea1ae11d194a60b18e1e43e1db243 12-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> search for overridden methods with comment when overriding method
has none of its own. Factor in Doug's comments.
// rdar://12378793

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165771 91177308-0d34-0410-b5e6-96231b3b80d8
21c3607282550779c9ae5fe784928597807fd110 09-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move the logic that searches for overridden methods from libclang to
ASTContext so that it can be widely available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165473 91177308-0d34-0410-b5e6-96231b3b80d8
1952354bd376062c3ab3d328c0fc6c36530c9309 29-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164892 91177308-0d34-0410-b5e6-96231b3b80d8
023bd7d6ff3bf9ad6c9fa2e404924195e4f31584 27-Sep-2012 Benjamin Kramer <benny.kra@googlemail.com> Pass PrintingPolicy by reference, copying it isn't cheap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164781 91177308-0d34-0410-b5e6-96231b3b80d8
f3477c13eeaf11b32a41f181398fb5deffd0dd73 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164769 91177308-0d34-0410-b5e6-96231b3b80d8
94ff8e1f57c6382d91d0de981a4f311509d83e37 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164766 91177308-0d34-0410-b5e6-96231b3b80d8
f56faa01936b9cf909623d7f06e3c2569ca4a78e 15-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163983 91177308-0d34-0410-b5e6-96231b3b80d8
1824d54df85a462ada812dadda18130f951d40f3 13-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix Doxygen misuse: refer to parameter names in paragraphs correctly (\arg is
not what most people want -- it starts a new paragraph).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163793 91177308-0d34-0410-b5e6-96231b3b80d8
127ff2ea6440c3da4b47f9c8b3b190254a97e7b5 13-Sep-2012 Ted Kremenek <kremenek@apple.com> Conditionally parse documentation comments in system headers by
passing -fretain-comments-from-system-headers. By default, the
compiler no longer parses such documentation comments, as they
can result in a noticeable compile time/PCH slowdown.

Fixes <rdar://problem/11860820>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163778 91177308-0d34-0410-b5e6-96231b3b80d8
e4330a302ac20b41b9800267ebd4b5b01f8553f8 10-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.

Now we have a list of all commands. This is a good thing in itself, but it
also enables us to easily implement typo correction for command names.

With this change we have objects that contain information about each command,
so it makes sense to resolve command name just once during lexing (currently we
store command names as strings and do a linear search every time some property
value is needed). Thus comment token and AST nodes were changed to contain a
command ID -- index into a tables of builtin and registered commands. Unknown
commands are registered during parsing and thus are also uniformly assigned an
ID. Using an ID instead of a StringRef is also a nice memory optimization
since ID is a small integer that fits into a common bitfield in Comment class.

This change implies that to get any information about a command (even a command
name) we need a CommandTraits object to resolve the command ID to CommandInfo*.
Currently a fresh temporary CommandTraits object is created whenever it is
needed since it does not have any state. But with this change it has state --
new commands can be registered, so a CommandTraits object was added to

Also, in libclang CXComment has to be expanded to include a CXTranslationUnit
so that all functions working on comment AST nodes can get a CommandTraits
object. This breaks binary compatibility of CXComment APIs.

Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't
need TU parameter anymore, so it was removed. This is a source-incompatible
change for this C API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163540 91177308-0d34-0410-b5e6-96231b3b80d8
762f159c3295552f1f3e5e1af8b66385bfaed786 09-Sep-2012 Abramo Bagnara <abramo.bagnara@bugseng.com> Added missing const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163477 91177308-0d34-0410-b5e6-96231b3b80d8
ca0d10edcf1192ab8546a75e8be5bab7ef32e488 02-Sep-2012 James Dennett <jdennett@google.com> Documentation cleanup: Add \file comment for ASTContest.h, add \brief to many
items, remove redundant names from doc comments, fix various typos, and tidy
up some wording.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163085 91177308-0d34-0410-b5e6-96231b3b80d8
a6c66cedc022c9e5d45a937d6b8cff491a6bf81b 31-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call. Fixes PR13195.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
961713055e636170da59d7006a878cb4ba518a5d 30-Aug-2012 Fariborz Jahanian <fjahanian@apple.com> objective-C: clang must implicitly convert
__objc_yes/__objc_no to (BOOL)1/(BOOL)0 when
BOOL is declared; otherwise it resorts to
default of 'signed char'. This is important to
selecting the correct Numeric API numberWithBool:
Can't have a clang test for this. Will checkin and
executable llvm test. // rdar://12156616

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162922 91177308-0d34-0410-b5e6-96231b3b80d8
70517ca5c07c4b41ff8662b94ee22047b0299f8c 23-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix a bunch of -Wdocumentation warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162452 91177308-0d34-0410-b5e6-96231b3b80d8
929bbfb0b69165b55da3c56abf22aa10e20dadc6 21-Aug-2012 John McCall <rjmccall@apple.com> When performing a trivial copy of a C++ type, we must be careful not
to overwrite objects that might have been allocated into the type's
tail padding. This patch is missing some potential optimizations where
the destination is provably a complete object, but it's necessary for

Patch by Jonathan Sauer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162254 91177308-0d34-0410-b5e6-96231b3b80d8
1599eac40a3b28de0824013dc2fb90551dfa01b0 16-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Attaching comments to declarations: parse the comment in context of the
declaration it was attached to.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162033 91177308-0d34-0410-b5e6-96231b3b80d8
c41ace950dcf2254c9aa48e73647b89c35109f80 14-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Attaching comments to redeclarations: fix wrong assumptions

The reason for the recent fallout for "attaching comments to any redeclaration"
change are two false assumptions:
(1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y'
where we want the comment to be attached to both X and Y);
(2) the whole redeclaration chain has only a single comment (obviously false, the
user can put a separate comment for each redeclaration).

To fix (1) I revert the part of the recent change where a 'Decl*' member was
introduced to RawComment. Now ASTContext has a separate DenseMap for mapping
'Decl*' to 'FullComment*'.

To fix (2) I just removed the test with this assumption. We might not parse
every comment in redecl chain if we already parsed at least one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161878 91177308-0d34-0410-b5e6-96231b3b80d8
f50555eedef33fd5a67d369aa0ae8a6f1d201543 11-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Attaching comments to declarations: find comment attached to any redeclaration

Not only look for the comment near the declaration itself, but also walk the
redeclaration chain: the previous declaration might have had a documentation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161722 91177308-0d34-0410-b5e6-96231b3b80d8
1abee64ad71519ea9d91f1fe76441b9cdb75b6c0 02-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> ASTContext.h: replace include by a forward declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161186 91177308-0d34-0410-b5e6-96231b3b80d8
8f88a1dcc57cfe8580eb1558a783ad8499bfe8e0 12-Jul-2012 Timur Iskhodzhanov <timurrrr@google.com> [Windows] Use thiscall as the default calling convention for class methods. PR12785

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160121 91177308-0d34-0410-b5e6-96231b3b80d8
a5ef44ff5d93a3be6ca67782828157a71894cf0c 11-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Enable comment parsing and semantic analysis to emit diagnostics. A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file. But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to. There is no easy way to find a decl by
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments. If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160078 91177308-0d34-0410-b5e6-96231b3b80d8
811c820257746b1799b790b6adc7804f44154011 06-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Don't store pointers into a std::vector (RawCommentList::Comments). Although
currently we take address of std::vector's contents only after we finished
adding all comments (so no reallocation can happen), this will change in

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159845 91177308-0d34-0410-b5e6-96231b3b80d8
8d3ba23f2d9e6c87794d059412a0808c9cbacb25 06-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Implement AST classes for comments, a real parser for Doxygen comments and a
very simple semantic analysis that just builds the AST; minor changes for lexer
to pick up source locations I didn't think about before.

Comments AST is modelled along the ideas of HTML AST: block and inline content.

* Block content is a paragraph or a command that has a paragraph as an argument
or verbatim command.
* Inline content is placed within some block. Inline content includes plain
text, inline commands and HTML as tag soup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159790 91177308-0d34-0410-b5e6-96231b3b80d8
fb40e3f10ccef93c4f8fb6bd4fe5a108fa6cd369 01-Jul-2012 Meador Inge <meadori@codesourcery.com> PR13189: va_list broken with precompiled headers

For some targets a structure named __va_list_tag is built to help define
the __builtin_va_list type. However, __va_list_tag was not being treated as a
predefined type thus causing problems when serializing the AST. This commit
fixes that oversight by adding the necessary support to treat __va_list_tag
as a predefined type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159508 91177308-0d34-0410-b5e6-96231b3b80d8
7e0f1ee35fe98d6751b9e736410f8254795b5f68 26-Jun-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix comment: refer to documentation comments in general, not just Doxygen comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159214 91177308-0d34-0410-b5e6-96231b3b80d8
59c30cd804c162dcc1c156bd3bab5c8f1dfd4749 20-Jun-2012 Dmitri Gribenko <gribozavr@gmail.com> Remove unused ASTContext& arg in RawCommentList::addComment, as pointed out by Chandler in commit message for r158807.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158845 91177308-0d34-0410-b5e6-96231b3b80d8
f95d4125c01fa7b98722ae8cfbceac4a87d037b4 20-Jun-2012 Chandler Carruth <chandlerc@gmail.com> Fix a big layering violation introduced by r158771.

That commit added a new library just to hold the RawCommentList. I've
started a discussion on the commit thread about whether that is really
meritted -- it certainly doesn't seem necessary at this stage.

However, the immediate problem is that the AST library has a hard
dependency on the Comment library, but the dependencies were set up
completely backward. In addition to the layering violation, this had an
unfortunate effect if scattering the Comments library dependency
throughout the build system, but inconsistently so -- several parts of
the CMake dependencies were missing and only showed up due to transitive
deps or the fact that the target wasn't being built by tho bots.

It turns out that the Comments library can't (currently) be a well
formed layer *below* the AST library either, as it has an API that
accepts an ASTContext. That parameter is currently unused, so maybe that
was a mistake?

Anyways, it really seems like this is logically part of the AST --
that's the whole point of the ASTContext providing access to it as far
as I can tell -- so I've merged it into the AST library to solve the
immediate layering violation problems and remove some of the churn from
our library dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158807 91177308-0d34-0410-b5e6-96231b3b80d8
aa0cd85838f2a024e589ea4e8c2094130065af21 20-Jun-2012 Dmitri Gribenko <gribozavr@gmail.com> Structured comment parsing, first step.

* Retain comments in the AST
* Serialize/deserialize comments
* Find comments attached to a certain Decl
* Expose raw comment text and SourceRange via libclang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158771 91177308-0d34-0410-b5e6-96231b3b80d8
75996d2bf191bd5d1e981b93b99f5b77add1266e 17-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup: escape "::" to eliminate a Doxygen warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158620 91177308-0d34-0410-b5e6-96231b3b80d8
c5613b26a24a33d7450e3d0bf315c6ccc920ce7b 16-Jun-2012 Meador Inge <meadori@codesourcery.com> Explicitly build __builtin_va_list.

The target specific __builtin_va_list types are now explicitly built instead
of injecting strings into the preprocessor input.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158592 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
49fdccb4595862828aa5cadc1497d466a8031dda 09-Jun-2012 Dmitri Gribenko <gribozavr@gmail.com> Convert comments to proper Doxygen comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158241 91177308-0d34-0410-b5e6-96231b3b80d8
93a8534090a6de23d655679205b974032d092a89 19-May-2012 Benjamin Kramer <benny.kra@googlemail.com> Simplify code, add an assertion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157111 91177308-0d34-0410-b5e6-96231b3b80d8
ad9689f3531c49e4bff467d9469993606800068c 17-May-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added two missing const qualifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156988 91177308-0d34-0410-b5e6-96231b3b80d8
392da48160bd92ceb486792780467cbfdb2d0e8c 04-May-2012 James Molloy <james.molloy@arm.com> Fix handling of wint_t - we can't assume wint_t is purely an integer promotion of wchar_t - they may differ in signedness.

Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned.

There'll be a followup commit to fix that.

Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156165 91177308-0d34-0410-b5e6-96231b3b80d8
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).

The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
8788b224aaa46ccb777e6a24550449dfbb9d195f 09-Mar-2012 Daniel Dunbar <daniel@zuster.org> Revert r152430 "[AST] Mark ASTContext::getTypeInfo and some friends as
LLVM_READONLY.", getTypeInfo() is totally not READONLY, which I should have
probably noticed given that I made it so mere hours ago. Oops.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152434 91177308-0d34-0410-b5e6-96231b3b80d8
29c6c6ef2459195ed2031b97e65a0787e43c1585 09-Mar-2012 Daniel Dunbar <daniel@zuster.org> [AST] Mark ASTContext::getTypeInfo and some friends as LLVM_READONLY.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152430 91177308-0d34-0410-b5e6-96231b3b80d8
bc5419a2edc4030d1a623576fe339fbd3eed17a6 09-Mar-2012 Daniel Dunbar <daniel@zuster.org> [AST] Memoize ASTContext::getTypeInfo().
- On -emit-llvm-only of 403.gcc/combine.c, for example, we make 160k calls to
getTypeInfo but only ever deal with 680 some distinct types.

I saw these speedups (user time):
403.gcc/combine.c -- 3.1%
OmniGroupFrameworks/NSBezierPath-OAExtensions.m -- 3.6%
JavaScriptCore/Interpreter.cpp -- 1.4%
which seems pretty sweet.

I ran some histograms on those compiles and we end up doing a ton of
getTypeInfo() on 'char' and 'int'. I tried splitting out a fast path for builtin
types, but this wasn't a win. Still kinda seems like we could be doing better

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152377 91177308-0d34-0410-b5e6-96231b3b80d8
29293cddc682091a16a71f513e605995473f7f45 07-Mar-2012 Dylan Noblesmith <nobled@dreamwidth.org> AST: fix build since r152060

The declarations of the operators no longer matched.
The definitions in ASTContext.h had 'throw()' removed,
but it was still present in Attr.h.

Somehow the buildbots missed this. clang merely warns about
a missing 'throw()' specification and suggested a Fix-It adding
it back, but gcc 4.5 is not so forgiving and gives an error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152167 91177308-0d34-0410-b5e6-96231b3b80d8
ebcb57a8d298862c65043e88b2429591ab3c58d3 06-Mar-2012 Ted Kremenek <kremenek@apple.com> Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals. This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch. It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152137 91177308-0d34-0410-b5e6-96231b3b80d8
faa7fac3f8627f53f2c5aa06f0ad8832098872f5 06-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use newly introduced const-goodness of TinyPtrVector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152108 91177308-0d34-0410-b5e6-96231b3b80d8
c1b0f7fa9b755ab59129ae85187d0d4f91379995 06-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use TinyPtrVector instead of UsuallyTinyPtrVector.

The latter is just a worse version of the former.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152096 91177308-0d34-0410-b5e6-96231b3b80d8
c112b9ce0aa54607c3bbad6db1c21da6bb786b58 06-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move clang/Basic/UsuallyTinyPtrVector.h to llvm/ADT/UsuallyTinyPtrVector.h.

Depends on llvm commit r152090.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152091 91177308-0d34-0410-b5e6-96231b3b80d8
792777c9028e5fc583a83fb3620c2f9e4f7ed1f9 06-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move include/clang/AST/UsuallyTinyPtrVector.h -> include/clang/Basic/UsuallyTinyPtrVector.h
and add an erase method to it.

Patch by Andrew Craik!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152082 91177308-0d34-0410-b5e6-96231b3b80d8
7034fb6c7be710883a970f82cb2da97bf1cf5cda 05-Mar-2012 Daniel Dunbar <daniel@zuster.org> ASTContext: Don't use nothrow specifications on the new operators for allocating
from the ASTContext.
- Doing so requires the compiler to generate null checks against the returned
result, but the BumpPtrAllocator never returns null pointers.
- The optimizer can usually eliminate such checks, but not always, so this
gives us tighter codegen in some places.
- It would be really nice if we could just use __builtin_unreachable or
something to tell the optimizer that the allocator never returns null, but
LLVM isn't currently that smart.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152060 91177308-0d34-0410-b5e6-96231b3b80d8
f64bc202a2bcdf7b10f418ad52aaa7366c8ffef9 23-Feb-2012 Fariborz Jahanian <fjahanian@apple.com> objective-c++: Type of an objc string literal is NSString, not 'id'.
// rdar://10907410

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151296 91177308-0d34-0410-b5e6-96231b3b80d8
ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa 22-Feb-2012 Douglas Gregor <dgregor@apple.com> Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy)
the lambda closure itself. Some aspects of the block literal are left
unspecified, namely the capture variable (which doesn't actually
exist) and the body (which will be filled in by IRgen because it can't
be written as an AST).

Because we're switching to this model, this patch also eliminates
tracking the copy-initialization expression for the block capture of
the conversion function, since that information is now embedded in the
synthesized block literal. -1 side tables FTW.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 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
c93dc7889644293e318e19d82830ea2acc45b678 20-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import IntrusiveRefCntPtr<> into clang namespace

The class name is long enough without the llvm:: added.
Also bring in RefCountedBase and RefCountedBaseVPTR.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150958 91177308-0d34-0410-b5e6-96231b3b80d8
f6e2e0291b8964ed41b4325e21dd90b86e791f10 16-Feb-2012 Douglas Gregor <dgregor@apple.com> Implicitly define a lambda's conversion functions (to function
pointers and block pointers). We use dummy definitions to keep the
invariant that an implicit, used definition has a body; IR generation
will substitute the actual contents, since they can't be represented
as C++.

For the block pointer case, compute the copy-initialization needed to
capture the lambda object in the block, which IR generation will need

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150645 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
f8af98286022f72157d84951b48fde5fb369ab29 12-Feb-2012 Douglas Gregor <dgregor@apple.com> Within the body of a lambda expression, decltype((x)) for an
id-expression 'x' will compute the type based on the assumption that
'x' will be captured, even if it isn't captured, per C++11
[expr.prim.lambda]p18. There are two related refactors that go into
implementing this:

1) Split out the check that determines whether we should capture a
particular variable reference, along with the computation of the
type of the field, from the actual act of capturing the
2) Always compute the result of decltype() within Sema, rather than
AST, because the decltype() computation is now context-sensitive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150347 91177308-0d34-0410-b5e6-96231b3b80d8
4d8d22bfaed6e5d7da6b5556415b18c43b44e36c 10-Feb-2012 Douglas Gregor <dgregor@apple.com> Extend CXXRecordDecl with a function that determines the mapping from
the variables captured by a lambda to the fields that store the
captured values. To be used in IRgen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150235 91177308-0d34-0410-b5e6-96231b3b80d8
200fa53fd420aa8369586f569dbece04930ad6a3 08-Feb-2012 John McCall <rjmccall@apple.com> Revise the SplitQualType interface to make it its own thing instead of
a typedef of std::pair. This slightly improves type-safety, but mostly
makes code using it clearer to read as well as making it possible to add
methods to the type.

Add such a method for efficiently single-step desugaring a split type.
Add a method to single-step desugaring a locally-unqualified type.
Implement both the SplitQualType and QualType methods in terms of that.

Also, fix a typo ("ObjCGLifetime").

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150028 91177308-0d34-0410-b5e6-96231b3b80d8
d7a3e2c5f61cd4893f95b69a424fe4def3aa0f69 07-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.

This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
6f42b62b6194f53bcbc349f5d17388e1936535d7 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import OwningPtr<> into clang namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149798 91177308-0d34-0410-b5e6-96231b3b80d8
00bd44d5677783527d7517c1ffe45e4d75a0f56f 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.

Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149781 91177308-0d34-0410-b5e6-96231b3b80d8
ef9b60ffed980864a8db26ad30344be429e58ff5 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move Storage and StorageAllocator out of the PartialDiagnostic class so we can forward declare them.

Let ASTContext allocate the storage in its BumpPtrAllocator.
This will help us remove ASTContext's depedency on PartialDiagnostic.h soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149780 91177308-0d34-0410-b5e6-96231b3b80d8
8deabc133c121f6c5561d0b2171a41cb2c29b2ce 03-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move isSentinelNullExpr() from Sema to ASTContext to make it more widely

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149675 91177308-0d34-0410-b5e6-96231b3b80d8
453dbcbe30093fbf947a0bec2fbd46e9694eafe9 26-Jan-2012 Douglas Gregor <dgregor@apple.com> Extend the ExternalASTSource interface to allow the AST source to
provide the layout of records, rather than letting Clang compute
the layout itself. LLDB provides the motivation for this feature:
because various layout-altering attributes (packed, aligned, etc.)
don't get reliably get placed into DWARF, the record layouts computed
by LLDB from the reconstructed records differ from the actual layouts,
and badness occurs. This interface lets the DWARF data drive layout,
so we don't need the attributes preserved to get the answer write.

The testing methodology for this change is fun. I've introduced a
variant of -fdump-record-layouts called -fdump-record-layouts-simple
that always has the simple C format and provides size/alignment/field
offsets. There is also a -cc1 option -foverride-record-layout=<file>
to take the output of -fdump-record-layouts-simple and parse it to
produce a set of overridden layouts, which is introduced into the AST
via a testing-only ExternalASTSource (called
LayoutOverrideSource). Each test contains a number of records to lay
out, which use various layout-changing attributes, and then dumps the
layouts. We then run the test again, using the preprocessor to
eliminate the layout-changing attributes entirely (which would give us
different layouts for the records), but supplying the
previously-computed record layouts. Finally, we diff the layouts
produced from the two runs to be sure that they are identical.

Note that this code makes the assumption that we don't *have* to
provide the offsets of bases or virtual bases to get the layout right,
because the alignment attributes don't affect it. I believe this
assumption holds, but if it does not, we can extend
LayoutOverrideSource to also provide base offset information.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149055 91177308-0d34-0410-b5e6-96231b3b80d8
a6ea10e22b600d92e084f6b11b9b9a92d0eb2412 17-Jan-2012 Douglas Gregor <dgregor@apple.com> Delay the creation of the built-in Objective-C class 'Protocol' by
moving it from a "special type" to a predefined declaration, as we do
for id, Class, and SEL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148313 91177308-0d34-0410-b5e6-96231b3b80d8
2d6a5670465cb3f1d811695a9f23e372508240d2 14-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148178 91177308-0d34-0410-b5e6-96231b3b80d8
0af550115df1f57f17a4f125ff0e8b34820c65d1 16-Dec-2011 Douglas Gregor <dgregor@apple.com> Fix chaining of ObjCInterfaceDecl redeclarations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146722 91177308-0d34-0410-b5e6-96231b3b80d8
e664977aca2a05a77abab5a06dc0fb69e870cfb9 03-Dec-2011 Douglas Gregor <dgregor@apple.com> Keep track of all of the import declarations that are parsed or
implicitly generated in a translation unit. Modules will need this
information to identify the actual imports that occurred.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145734 91177308-0d34-0410-b5e6-96231b3b80d8
dc8dab6fabf4bfd4f4b94bf572ac3342a5bbfcd7 30-Nov-2011 Bob Wilson <bob.wilson@apple.com> Add bigger method type encodings to protocol objects. <rdar://problem/10492418>

The new metadata are method @encode strings with additional data.

1. Each Objective-C object is marked with its class name and protocol names.
The same is done for property @encode already.

2. Each block object is marked with its function prototype's @encoding. For
example, a method parameter that is a block object that itself returns void
and takes an int would look like:

These new method @encode strings are stored in a single array pointed to by structs protocol_t and objc_protocol_ext.

Patch provided by Greg Parker!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145469 91177308-0d34-0410-b5e6-96231b3b80d8
e2d4f4ed44a32f179c6d48cd1dba8346ab2129d9 13-Nov-2011 Rafael Espindola <rafael.espindola@gmail.com> Fix the signature of the getcontext builtin. Patch by Dimitry Andric.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144505 91177308-0d34-0410-b5e6-96231b3b80d8
87ec9c257c99b4136af6c7f5be5a2d486906ba84 01-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] For a class extension, give it a unique USR but for any property or ivar
it contains give it a USR based on its semantic context, which is the interface.

This follows what we already did for objc methods. rdar://10371669

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143464 91177308-0d34-0410-b5e6-96231b3b80d8
c49bd11f96c2378969822f1f1b814ffa8f2bfee4 28-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r142844 (reverted in r142872) now that lvalue-to-rvalue conversions
are present in all the necessary places:

In constant expression evaluation, evaluate lvalues as lvalues and rvalues as
rvalues. Remove special case for caching reference initialization and fix a
cyclic initialization crash in the process.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143204 91177308-0d34-0410-b5e6-96231b3b80d8
29e97cb35fab314388f62b68fefa78947e93c1dc 27-Oct-2011 Hans Wennborg <hans@hanshq.net> Teach format string analysis that "%zu" means size_t.

The code had it backwards, thinking size_t was signed, and using that for "%zd".

Also let the analysis get the types for (u)intmax_t while we are at it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143099 91177308-0d34-0410-b5e6-96231b3b80d8
3c3b7f90a863af43fa63043d396553ecf205351c 25-Oct-2011 John McCall <rjmccall@apple.com> Restore r142914 and r142915, now with missing file and apparent
GCC compiler workaround.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142931 91177308-0d34-0410-b5e6-96231b3b80d8
327a50f46449c946c42d50d97689bcb30e2af7d9 25-Oct-2011 NAKAMURA Takumi <geek4civic@gmail.com> Revert r142914 and r142915, due to possibly missing file.

r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142921 91177308-0d34-0410-b5e6-96231b3b80d8
a1b852f8e1bee5ed3604ee483803cef39ce57a20 25-Oct-2011 John McCall <rjmccall@apple.com> Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142914 91177308-0d34-0410-b5e6-96231b3b80d8
097f6b008254dc7b7f89ec3daafc163bf2a0e307 18-Oct-2011 Douglas Gregor <dgregor@apple.com> Remove unused data member

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142425 91177308-0d34-0410-b5e6-96231b3b80d8
0ddaeb9b031070ec64afe92d9892875ac44df427 17-Oct-2011 John McCall <rjmccall@apple.com> Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142208 91177308-0d34-0410-b5e6-96231b3b80d8
aa4a99b4a62615db243f7a5c433169f2fc704420 15-Oct-2011 Anton Korobeynikov <asl@math.spbu.ru> Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142016 91177308-0d34-0410-b5e6-96231b3b80d8
72b2625aa67c8213acaf4bf6209b67859d60e2cf 14-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Serialize info about redeclared objc methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141964 91177308-0d34-0410-b5e6-96231b3b80d8
b40034c2e580ab3b08de9dfb738d8e5d8ef79136 14-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Keep track of objc method redeclarations in the same interface.

Avoid possible infinite loop when iterating over an ObjCMethod's redeclarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141946 91177308-0d34-0410-b5e6-96231b3b80d8
b001de7458d17c17e6d8b8034c7cfcefd3b70c00 07-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.

Thanks to Jeffrey Yasskin for the thorough review!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141330 91177308-0d34-0410-b5e6-96231b3b80d8
d211cb709510fbe7e75167b9feee0050851d001a 06-Oct-2011 Ted Kremenek <kremenek@apple.com> Use a sidetable in ASTContext for ParmVarDecls whose index exceeds the 8 bits reserved for that value in VarDecl. Fixes PR 10538.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141273 91177308-0d34-0410-b5e6-96231b3b80d8
78213e4aec6d8d22b5828dd2687fa19116ebaa26 28-Sep-2011 Fariborz Jahanian <fjahanian@apple.com> objc arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This is objc side of
// rdar://10187884

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140729 91177308-0d34-0410-b5e6-96231b3b80d8
8987b2385d9ba63ada66e1344ace79b04d5cb5c3 28-Sep-2011 Douglas Gregor <dgregor@apple.com> Only print _Bool as 'bool' when 'bool' is defined as an object-like
macro whose only replacement token is '_Bool'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140656 91177308-0d34-0410-b5e6-96231b3b80d8
30c42404202d2e2512e51efc6066bd614cfdb5a4 28-Sep-2011 Douglas Gregor <dgregor@apple.com> When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140650 91177308-0d34-0410-b5e6-96231b3b80d8
d6471f7c1921c7802804ce3ff6fe9768310f72b9 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename Diagnostic to DiagnosticsEngine as per issue 5397

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
e97179c675b341927807c718be215c8d1aab8acb 08-Sep-2011 Douglas Gregor <dgregor@apple.com> Implement the Objective-C 'instancetype' type, which is an alias of
'id' that can be used (only!) via a contextual keyword as the result
type of an Objective-C message send. 'instancetype' then gives the
method a related result type, which we have already been inferring for
a variety of methods (new, alloc, init, self, retain). Addresses

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139275 91177308-0d34-0410-b5e6-96231b3b80d8
bcfd1f55bfbb3e5944cd5e03d07b343e280838c4 02-Sep-2011 Douglas Gregor <dgregor@apple.com> Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138985 91177308-0d34-0410-b5e6-96231b3b80d8
3e3cd93b2fd9644e970c389e715c13883faf68b6 01-Sep-2011 Douglas Gregor <dgregor@apple.com> Teach ASTContext and Preprocessor to hold on to references to the same
LangOptions, rather than making distinct copies of
LangOptions. Granted, LangOptions doesn't actually get modified, but
this will eventually make it easier to construct ASTContext and
Preprocessor before we know all of the LangOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138959 91177308-0d34-0410-b5e6-96231b3b80d8
0d95f0d7b81110f77e99e833f766d19be7b7e072 14-Aug-2011 Francois Pichet <pichet2000@gmail.com> Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137585 91177308-0d34-0410-b5e6-96231b3b80d8
af0f4d0b2e38c810effc8b024ad2fb6604eec5d3 14-Aug-2011 Francois Pichet <pichet2000@gmail.com> Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.

template <class T>
class A {
template <class U> void f(U p) { }
template <> void f(int p) { } // <== class scope specialization

This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137573 91177308-0d34-0410-b5e6-96231b3b80d8
772eeaefef2c883aabe35caf4543e7e32d290183 12-Aug-2011 Douglas Gregor <dgregor@apple.com> Switch the __int128_t and __uint128_t types over to predefined types
in the AST format, which are built lazily by the ASTContext when

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137437 91177308-0d34-0410-b5e6-96231b3b80d8
7a27ea52b7bd635c89bec5a9c521a3bf7d204238 12-Aug-2011 Douglas Gregor <dgregor@apple.com> Switch the Objective-C 'SEL' type over to a predefined type in the
AST file format, lazily generating the actual declaration in
ASTContext as needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137434 91177308-0d34-0410-b5e6-96231b3b80d8
79d6726921897811232554ed94c5d77b5b7b3fc0 12-Aug-2011 Douglas Gregor <dgregor@apple.com> Switch the Objective-C 'Class' type over to a predefined type in the
AST file format, lazily generating the actual declaration in
ASTContext as needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137431 91177308-0d34-0410-b5e6-96231b3b80d8
4dfd02a17c6d604c72e6936527c5e1c56d3ecb7a 12-Aug-2011 Douglas Gregor <dgregor@apple.com> Move the creation of the predefined typedef for Objective-C's 'id'
type over into the AST context, then make that declaration a
predefined declaration in the AST format. This ensures that different
AST files will at least agree on the (global) declaration ID for 'id',
and eliminates one of the "special" types in the AST file format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137429 91177308-0d34-0410-b5e6-96231b3b80d8
01a4cf11777bb34c35f5d251a9e95eb736d0842b 11-Aug-2011 Douglas Gregor <dgregor@apple.com> Encapsulate the Objective-C id/Class/SEL "redefinition" types in
ASTContext with accessors/mutators. The only functional change is that
the AST writer won't bother writing the id/Class/SEL redefinition type
if it hasn't been explicitly set; previously, it ended up being
written as a synonym for the built-in id/Class/SEL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137349 91177308-0d34-0410-b5e6-96231b3b80d8
0815b579b31cb3129f732bb7ea36fd6ba6949e98 09-Aug-2011 Douglas Gregor <dgregor@apple.com> Move the creation of the record type for the state of Objective-C fast
enumerations from the ASTContext into CodeGen, so that we don't need
to serialize it to AST files. This appears to be the last of the
low-hanging fruit for SpecialTypes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137124 91177308-0d34-0410-b5e6-96231b3b80d8
5c0d3d66bf06213009802876a14e6298efc1e0b0 09-Aug-2011 Douglas Gregor <dgregor@apple.com> Don't serialize the block descriptor or block extended descriptor
types to AST files; they're only used by debug info generation anyway,
and shouldn't ever exist in the AST anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137122 91177308-0d34-0410-b5e6-96231b3b80d8
45c4ea75b235de94f44bf96843624e6a559e4c00 09-Aug-2011 Douglas Gregor <dgregor@apple.com> Move the construction of the RecordDecl representing the runtime
layout of a constant NSString from the ASTContext over to CodeGen,
since this is solely CodeGen's responsibility. Eliminates one of the
unnecessary "special" types that we serialize.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137121 91177308-0d34-0410-b5e6-96231b3b80d8
8e68f1c8a2919ea83c2053731d6011074f1062e1 05-Aug-2011 Roman Divacky <rdivacky@freebsd.org> Let attribute((cdecl)) and company override -mrtd default calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136971 91177308-0d34-0410-b5e6-96231b3b80d8
dd7fddb5b6883326e52b278a9b7e9cefea29aae0 05-Aug-2011 Chad Rosier <mcrosier@apple.com> More whitespace and naming fixup. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136944 91177308-0d34-0410-b5e6-96231b3b80d8
db8264e4c5ffd7af6fbad4ca4306bd382bb02691 22-Jul-2011 Jordy Rose <jediknil@belkadan.com> Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin.
This was previously not-const only because it has to lazily construct a chain
of ivars the first time it is called (and after the chain is invalidated).
In practice, all the clients were just const_casting their const Decls;
all those now-unnecessary const_casts have been removed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135741 91177308-0d34-0410-b5e6-96231b3b80d8
db999aad8a1b9dc265b2e627be334be6580a86a3 20-Jul-2011 Chris Lattner <sabre@nondot.org> remove some now-redundant forward declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135578 91177308-0d34-0410-b5e6-96231b3b80d8
8cc488fefb2fb04bc8d5398da29f0182f97934cf 20-Jul-2011 Chris Lattner <sabre@nondot.org> add raw_ostream and Twine to LLVM.h, eliminating a ton of llvm:: qualifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135577 91177308-0d34-0410-b5e6-96231b3b80d8
686775deca8b8685eb90801495880e3abdd844c2 20-Jul-2011 Chris Lattner <sabre@nondot.org> now that we have a centralized place to do so, add some using declarations for
some common llvm types: stringref and smallvector. This cleans up the codebase
quite a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135576 91177308-0d34-0410-b5e6-96231b3b80d8
c286f3835eb6001c61664cef5d610dfaf80a6e9b 13-Jul-2011 Fariborz Jahanian <fjahanian@apple.com> objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. // rdar://9740328

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135001 91177308-0d34-0410-b5e6-96231b3b80d8
79e6bd379773447a74cc3e579d9081e4c5cb6d63 12-Jul-2011 Douglas Gregor <dgregor@apple.com> Centralize the getCanonicalType() calls in the Itanium C++ mangling
code so that they only occur in a single place. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134961 91177308-0d34-0410-b5e6-96231b3b80d8
31862ba5ea70b1f2c81d03f8a0100b61cd6f06f6 02-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
static_cast<NSString**>(&x); // Casting as (__strong NSString**).

This currently only works for C++ named casts, C casts to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134273 91177308-0d34-0410-b5e6-96231b3b80d8
146060435c3efce95c95a092c7a1eb651cfb9ae0 30-Jun-2011 John McCall <rjmccall@apple.com> Preserve that a TemplateName was arrived at by substituting
for a template template parameter.

Uses to follow.

I've also made the uniquing of SubstTemplateTemplateParmPacks
use a ContextualFoldingSet as a minor space efficiency.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134137 91177308-0d34-0410-b5e6-96231b3b80d8
f85e193739c953358c865005855253af4f68a497 16-Jun-2011 John McCall <rjmccall@apple.com> Automatic Reference Counting.

Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
f968d8374791c37bc464efd9168c2d33dd73605f 27-May-2011 Douglas Gregor <dgregor@apple.com> Objective-C doesn't consider the use of incomplete types as method
parameter types to be ill-formed. However, it relies on the
completeness of method parameter types when producing metadata, e.g.,
for a protocol, leading IR generating to crash in such cases.

Since there's no real way to tighten down the semantics of Objective-C
here without breaking existing code, do something safe but lame:
suppress the generation of metadata when this happens.

Fixes <rdar://problem/9123036>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132171 91177308-0d34-0410-b5e6-96231b3b80d8
ffe37fdda5b4b4f162a45155c30d9f60ce110c12 25-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a little bit of cleanup and a lot more of the base work
behind implicit moves. We now correctly identify move constructors and
assignment operators and update bits on the record correctly. Generation
of implicit moves (declarations or definitions) is not yet supported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132080 91177308-0d34-0410-b5e6-96231b3b80d8
ca63c200346c0ca9e00194ec6e34a5a7b0ed9321 25-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132017 91177308-0d34-0410-b5e6-96231b3b80d8
575a1c9dc8dc5b4977194993e289f9eda7295c39 20-May-2011 Douglas Gregor <dgregor@apple.com> Introduce Type::isSignedIntegerOrEnumerationType() and
Type::isUnsignedIntegerOrEnumerationType(), which are like
Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also
consider the underlying type of a C++0x scoped enumeration type.

Audited all callers to the existing functions, switching those that
need to also handle scoped enumeration types (e.g., those that deal
with constant values) over to the new functions. Fixes PR9923 /

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
2636197098e02fd7c90f9496056b8ab886dcbff0 17-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Reapply the commits that r131401 reverted and add a fix for PR9927.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131446 91177308-0d34-0410-b5e6-96231b3b80d8
4ea030403d509f5b320b8e1d7952447aba5c2f6c 16-May-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert 131377, 131369 and 131365.
131365 caused PR9927.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131401 91177308-0d34-0410-b5e6-96231b3b80d8
02c5116db6a40e806534c416e0abb22b8840831e 14-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.

Go through and expand the members of bases into the encoding string (and encode the VTable as well).
Unlike gcc which expands virtual bases as many times as they appear in the
hierarchy, clang will only expand them once at the end, to reflect the actual layout.

Note that there doesn't seem to be a way to indicate in the encoding that
packing/alignment of members is different that normal, in which case
the encoding will be out-of-sync with the real layout.
If the runtime switches to just consider the size of types without
taking into account alignment, we could easily make padding explicit in the
encoding (e.g. using arrays of chars). The encoding strings would be
longer then though.

Also encode a flexible array member as array of 0 size, like gcc, not as a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131365 91177308-0d34-0410-b5e6-96231b3b80d8
52bbe7a1133c3cb57e9246f1b96c12940ea3821a 06-May-2011 Fariborz Jahanian <fjahanian@apple.com> Establish a new alignment for an ms_struct bitfield following
a non-bitfield if size of their types differ.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131023 91177308-0d34-0410-b5e6-96231b3b80d8
9b3acaa32548d0ce78b9c39a3911397f6738a47c 04-May-2011 Fariborz Jahanian <fjahanian@apple.com> More ms_struct bitfield stuff:
Adjacent bit fields are packed into the same 1-, 2-, or
4-byte allocation unit if the integral types are the same
size. // rdar://8823265.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130851 91177308-0d34-0410-b5e6-96231b3b80d8
340fa242130c2d8d74c83edca0952e771aebe0e6 02-May-2011 Fariborz Jahanian <fjahanian@apple.com> More rule enforcement of zero bitfields for ms_struct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130696 91177308-0d34-0410-b5e6-96231b3b80d8
4fb86f8c4585e53c21c847ad3de9e3b2de123cd9 01-May-2011 Chandler Carruth <chandlerc@gmail.com> Re-applies the patch first applied way back in r106099, with
accompanying fixes to make it work today.

The core of this patch is to provide a link from a TemplateTypeParmType
back to the TemplateTypeParmDecl node which declared it. This in turn
provides much more precise information about the type, where it came
from, and how it functions for AST consumers.

To make the patch work almost a year after its first attempt, it needed
serialization support, and it now retains the old getName() interface.
Finally, it requires us to not attempt to instantiate the type in an
unsupported friend decl -- specifically those coming from template
friend decls but which refer to a specific type through a dependent

A cleaner representation of the last item would be to build
FriendTemplateDecl nodes for these, storing their template parameters
etc, and to perform proper instantation of them like any other template
declaration. They can still be flagged as unsupported for the purpose of
access checking, etc.

This passed an asserts-enabled bootstrap for me, and the reduced test
case mentioned in the original review thread no longer causes issues,
likely fixed at somewhere amidst the 24k revisions that have elapsed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130628 91177308-0d34-0410-b5e6-96231b3b80d8
ba29bd25515fbd99e98ba0fedb9d93617b27609e 28-Apr-2011 Ted Kremenek <kremenek@apple.com> Enhance clang_getCXTUResourceUsage() to report the amount of memory used by ASTContext's side tables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130383 91177308-0d34-0410-b5e6-96231b3b80d8
14d56ef43ff4921c6749f7340212fbb743fdbb9b 27-Apr-2011 Fariborz Jahanian <fjahanian@apple.com> Some refactoring of my ms_struct patch.
// rdar://8823265 related.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130311 91177308-0d34-0410-b5e6-96231b3b80d8
864c041e118155c2b1ce0ba36942a3da5a4a055e 26-Apr-2011 John McCall <rjmccall@apple.com> Make yet another placeholder type, this one marking that an expression is a bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function. Diagnose this in the general case. Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130239 91177308-0d34-0410-b5e6-96231b3b80d8
61e0b94838127601718c64b80940868d4b995e1f 19-Apr-2011 Ted Kremenek <kremenek@apple.com> Add ASTContext::getTotalMemory() to allow clients to query how much memory is bump allocated for declarations, statements, and types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129729 91177308-0d34-0410-b5e6-96231b3b80d8
162e1c1b487352434552147967c3dd296ebee2f7 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Support for C++11 (non-template) alias declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129567 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
1de4d4e8cb2e9c88809fea8092bc6e835a5473d2 07-Apr-2011 John McCall <rjmccall@apple.com> Basic, untested implementation for an "unknown any" type requested by LLDB.
The idea is that you can create a VarDecl with an unknown type, or a
FunctionDecl with an unknown return type, and it will still be valid to
access that object as long as you explicitly cast it at every use. I'm
still going back and forth about how I want to test this effectively, but
I wanted to go ahead and provide a skeletal implementation for the LLDB
folks' benefit and because it also improves some diagnostic goodness for
placeholder expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129065 91177308-0d34-0410-b5e6-96231b3b80d8
0a0d2b179085a52c10402feebeb6db8b4d96a140 23-Mar-2011 Douglas Gregor <dgregor@apple.com> Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

void foo()

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

- If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
will result in a deprecation warning, as if we had placed
attribute((deprecated)) on it (but with a better diagnostic)
- If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
will result in an "unavailable" warning (in C)/error (in C++), as
if we had placed attribute((unavailable)) on it
- If we choose a deployment target prior to 10.2, foo() is
weak-imported (if it is a kind of entity that can be weak
imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128127 91177308-0d34-0410-b5e6-96231b3b80d8
4f32786ac45210143654390177105eb749b614e9 21-Mar-2011 Ted Kremenek <kremenek@apple.com> Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes.

This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct
ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8
207f4d8543529221932af82836016a2ef066c917 18-Mar-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers. Patch originally by ARM;
language-specific address space support by myself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127915 91177308-0d34-0410-b5e6-96231b3b80d8
a4fdbfad150ae37bddaa4094d3925a27a1a1cf3f 14-Mar-2011 Fariborz Jahanian <fjahanian@apple.com> Block return type of the initialized must be
be more speciaclized than that of the initializer,
when matching protocol qualifier list.
// rdar:// 9118343.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127585 91177308-0d34-0410-b5e6-96231b3b80d8
d05c2006f2fca763be9680ab673f7c66adbf90a1 13-Mar-2011 Anders Carlsson <andersca@mac.com> Change GetNullarySelector and GetUnarySelector to take a StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127571 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
8178df3b39ab923ff5d24538812628abee33df79 22-Feb-2011 John McCall <rjmccall@apple.com> Emit the structure layout of the block literal parameter to a block
invocation function into the debug info. Rather than faking up a class,
which is tricky because of the custom layout we do, we just emit a struct
directly from the layout information we've already got.

Also, don't emit an unnecessarily parameter alloca for this "variable".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126255 91177308-0d34-0410-b5e6-96231b3b80d8
483b9f3bc05c5409e2c6643f1c9d91e21c8ff9d2 21-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Tweaks to C++0x deduced auto type support:
* Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema
* Temporary template parameter list for auto deduction is now allocated on the stack.
* Deduced 'auto' types are now uniqued.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126139 91177308-0d34-0410-b5e6-96231b3b80d8
34b41d939a1328f484511c6002ba2456db879a29 20-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement the C++0x deduced 'auto' feature.

This fixes PR 8738, 9060 and 9132.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126069 91177308-0d34-0410-b5e6-96231b3b80d8
bee5a79fc95e3003d755031e3d2bb4410a71e1c1 20-Feb-2011 Ken Dyck <kd@kendyck.com> Add const qualifier to getTypeInfoInChars().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126064 91177308-0d34-0410-b5e6-96231b3b80d8
16f744beaaa30bf3847740ca8e8beb6f0d3a0b93 18-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce ASTContext::getLogicalOperationType() to return bool or int, depending on language.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125957 91177308-0d34-0410-b5e6-96231b3b80d8
dd76a9ab9ea675671200f94b18ce95766841952b 11-Feb-2011 Ken Dyck <kd@kendyck.com> Add a helper function, ASTContext::toBits(), that converts sizes in
CharUnits to sizes in bits, and use it to tidy up the places where the
conversion was done explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125332 91177308-0d34-0410-b5e6-96231b3b80d8
14b6ba77710d6431794d65c7d58c6f29c3dc956e 09-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> AST, Sema, Serialization: keep track of cudaConfigureCall

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125216 91177308-0d34-0410-b5e6-96231b3b80d8
6b5a61b6dc400027fd793dcadceeb9da944a37ea 07-Feb-2011 John McCall <rjmccall@apple.com> A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
- BDREs no longer store copy expressions
- BlockDecls now store a list of captured variables, information about
how they're captured, and a copy expression if necessary

With that in hand, change IR generation to use the captures data in
blocks instead of walking the block independently.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125005 91177308-0d34-0410-b5e6-96231b3b80d8
8b789139167d721e3ef1e3d433eabeb351c36fad 05-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> -Wselector should warn on implemented selectors only
when selector metadata is generated, which is triggered
by at least on class implementation. This is to match gcc's
behavior. // rdar://8851684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124909 91177308-0d34-0410-b5e6-96231b3b80d8
63e7d25d2e6036616b42f744fd4a39cd5f911960 27-Jan-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed parameter names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124408 91177308-0d34-0410-b5e6-96231b3b80d8
6952f1e4256c5b43aee5e98cea4e9b663bd1d413 19-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for non-type template parameter packs whose type is
a pack expansion, e.g., the parameter pack Values in:

template<typename ...Types>
struct Outer {
template<Types ...Values>
struct Inner;

This new implementation approach introduces the notion of an
"expanded" non-type template parameter pack, for which we have already
expanded the types of the parameter pack (to, say, "int*, float*",
for Outer<int*, float*>) but have not yet expanded the values. Aside
from creating these expanded non-type template parameter packs, this
patch updates template argument checking and non-type template
parameter pack instantiation to make use of the appropriate types in
the parameter pack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123845 91177308-0d34-0410-b5e6-96231b3b80d8
3b6575108a5b6d8b92ac3a9a7794bf6c3a210907 19-Jan-2011 John McCall <rjmccall@apple.com> Change the canonical representation of array types to store qualifiers on the
outermost array types and not on the element type. Move the CanonicalType
member from Type to ExtQualsTypeCommonBase; the canonical type on an ExtQuals
node includes the qualifiers on the ExtQuals. Assorted optimizations enabled
by this change.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123817 91177308-0d34-0410-b5e6-96231b3b80d8
f4c7371fb1d3cebcfb40abad4537bb82515704ea 19-Jan-2011 John McCall <rjmccall@apple.com> Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123814 91177308-0d34-0410-b5e6-96231b3b80d8
ce8890371fcdb983ae487c87fa40606a34896ff7 18-Jan-2011 John McCall <rjmccall@apple.com> Fix some unnecessarily complicated code for canonicalizing variably-modified
parameter types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123753 91177308-0d34-0410-b5e6-96231b3b80d8
eb6f5dc86531f794ba7746a2da4d28e37cf5da7e 15-Jan-2011 Ken Dyck <ken.dyck@onsemi.com> Add toCharUnitsInBits() to simplify the many calls to CharUnits::fromQuantity() of the form CharUnits::fromQuantity(bitSize, Context.getCharWidth()).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123542 91177308-0d34-0410-b5e6-96231b3b80d8
1aee05d08b2184acadeb36de300e216390780d6c 15-Jan-2011 Douglas Gregor <dgregor@apple.com> Introduce a new kind of TemplateName that captures a substituted
template template parameter pack that cannot be fully expanded because
its enclosing pack expansion could not be expanded. This form of
TemplateName plays the same role as SubstTemplateTypeParmPackType and
SubstNonTypeTemplateParmPackExpr do for template type parameter packs
and non-type template parameter packs, respectively.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123521 91177308-0d34-0410-b5e6-96231b3b80d8
cded4f649cd4b7ba7d461c25c6482ef52b8d3a2a 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Keep track of the number of expansions to be produced from a type pack
expansion, when it is known due to the substitution of an out
parameter pack. This allows us to properly handle substitution into
pack expansions that involve multiple parameter packs at different
template parameter levels, even when this substitution happens one
level at a time (as with partial specializations of member class
templates and the signatures of member function templates).

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123448 91177308-0d34-0410-b5e6-96231b3b80d8
c3069d618f4661d923cb1b5c4525b082fce73b04 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Start implementing support for substitution into pack expansions that
involve template parameter packs at multiple template levels that
occur within the signatures members of class templates (and partial
specializations thereof). This is a work-in-progress that is deficient
in several ways, notably:
- It only works for template type parameter packs, but we need to
also support non-type template parameter packs and template template
parameter packs.
- It doesn't keep track of the lengths of the substituted argument
packs in the expansion, so it can't properly diagnose length

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123425 91177308-0d34-0410-b5e6-96231b3b80d8
14110477887e3dc168ffc6c191e72d705051f99e 13-Jan-2011 Peter Collingbourne <peter@pcc.me.uk> Move name mangling support from CodeGen to AST. In the
process, perform a number of refactorings:

- Move MiscNameMangler member functions to MangleContext
- Remove GlobalDecl dependency from MangleContext
- Make MangleContext abstract and move Itanium/Microsoft functionality
to their own classes/files
- Implement ASTContext::createMangleContext and have CodeGen use it

No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123386 91177308-0d34-0410-b5e6-96231b3b80d8
4ba2a17694148e16eaa8d3917f657ffcd3667be4 12-Jan-2011 Jay Foad <jay.foad@gmail.com> PR3558: mark "logically const" accessor methods in ASTContext as const,
and mark the fields they use as mutable. This allows us to remove a few

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123314 91177308-0d34-0410-b5e6-96231b3b80d8
ae278a3a57595349a411f6474938d4dd1b263a0e 12-Jan-2011 John McCall <rjmccall@apple.com> Slight bugfix to the attribute-distribution logic for GC attributes.
Slight optimization of getObjCGCAttrKind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123295 91177308-0d34-0410-b5e6-96231b3b80d8
9d156a7b1b2771e191f2f5a45a7b7a694129463b 06-Jan-2011 John McCall <rjmccall@apple.com> Introduce an AttributedType, but don't actually use it anywhere yet.
The initial TreeTransform is a cop-out, but it's more-or-less equivalent
to what we were doing before, or rather what we're doing now and might
eventually stop doing in favor of using this type.
I am simultaneously intrigued by the possibilities of rebuilding a
dependent Attri

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122942 91177308-0d34-0410-b5e6-96231b3b80d8
5389f48b24937ad7b4093307128b3cbf25235654 30-Dec-2010 David Chisnall <csdavec@swan.ac.uk> Expose Objective-C type encodings of declarations to libclang users. This also adds a method in ASTContext which encodes FunctionDecls using the same encoding format that is used for Objective-C methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122639 91177308-0d34-0410-b5e6-96231b3b80d8
00ccbefcffeb88ea3e2e6323e594fa968753ad14 21-Dec-2010 John McCall <rjmccall@apple.com> Fix the noreturn conversion to only strip off a single level of indirection.
Apply the noreturn attribute while creating a builtin function's type.
Remove the getNoReturnType() API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122295 91177308-0d34-0410-b5e6-96231b3b80d8
7536dd5e6c99584481b7dab68b7e7d8df9c54054 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Introduce a new type, PackExpansionType, to capture types that are
pack expansions, e.g. given

template<typename... Types> struct tuple;

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

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122223 91177308-0d34-0410-b5e6-96231b3b80d8
e6a365d772a6b455f1e23ac9ae5f40d65a55a18c 19-Dec-2010 John McCall <rjmccall@apple.com> Motions towards simplifying how we deal with attribute-qualified function types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122162 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
075f8f1b6bed4d1b224c74f87508534cc6392ce6 10-Dec-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Added ParenType type node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121488 91177308-0d34-0410-b5e6-96231b3b80d8
f7616b9067790757f4e12e834b216c53c8c04ebe 10-Dec-2010 Douglas Gregor <dgregor@apple.com> Move the "volatile" bit into QualType's "fast" qualifier set,
increasing the required type alignment from 8 to 16. This provides a
2.5% speedup for -fsyntax-only on a token-cached Cocoa.h, while only
increasing memory consumption in the ASTContext by 0.8%.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121474 91177308-0d34-0410-b5e6-96231b3b80d8
830937bc1100fba7682f7c32c40512085870f50c 02-Dec-2010 Fariborz Jahanian <fjahanian@apple.com> IR Gen. part of API support for __block cxx
objects imported into blocks. //rdar://8594790.
Will have a test case coming (as well as one
sent to llvm test suite).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120713 91177308-0d34-0410-b5e6-96231b3b80d8
1ceee5c42d5c410217f67d384eecc6ea4a2bba9b 01-Dec-2010 Fariborz Jahanian <fjahanian@apple.com> Sema/AST work for capturing copy init expression
to be used in copy helper synthesis of __block
variables. wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120617 91177308-0d34-0410-b5e6-96231b3b80d8
dae0cb52e4e3d46bbfc9a4510909522197a92e54 25-Nov-2010 Anders Carlsson <andersca@mac.com> Move isNearlyEmpty out into the ASTContext so it can be called from CodeGen as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120137 91177308-0d34-0410-b5e6-96231b3b80d8
cf33b24441798f538fb5ab089edbba2ac3ba819c 13-Nov-2010 John McCall <rjmccall@apple.com> Bring UsualArithmeticConversionsType back into Sema and cast the
operands appropriately. There are a lot of missing complex-related
cast kinds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118993 91177308-0d34-0410-b5e6-96231b3b80d8
f69eb7cf8e616b5aad7911ec6f79b24b0a009227 12-Nov-2010 Bob Wilson <bob.wilson@apple.com> Generalize ASTContext::areCompatibleVectorTypes to handle new Neon vector types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118901 91177308-0d34-0410-b5e6-96231b3b80d8
e86d78cf4754a6aef2cf9a33d847aa15338e276f 10-Nov-2010 Bob Wilson <bob.wilson@apple.com> Add a variant of GCC-style vector types for ARM NEON.
NEON vector types need to be mangled in a special way to comply with ARM's ABI,
similar to some of the AltiVec-specific vector types. This patch is mostly
just renaming a bunch of "AltiVecSpecific" things, since they will no longer
be specific to AltiVec. Besides that, it just adds the new "NeonVector" enum.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118724 91177308-0d34-0410-b5e6-96231b3b80d8
ee743f903858e337434ac0335f147f4de4ecae05 09-Nov-2010 Charles Davis <cdavis@mines.edu> Use the right calling convention when mangling names in the Microsoft C++
mangler. Now member functions and pointers thereof have their calling
convention mangled as __thiscall if they have the default CC (even though,
they technically still have the __cdecl CC).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118598 91177308-0d34-0410-b5e6-96231b3b80d8
4846675e0e42d1802b0ffd8972a45e72aeb3758d 24-Oct-2010 Peter Collingbourne <peter@pcc.me.uk> Implement GNU C extension: two types are compatible if they appear
as a function argument, one of the types is a transparent union type
and the other type is compatible with a union member

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117243 91177308-0d34-0410-b5e6-96231b3b80d8
7b90340c9c7d07aef4e301e72b5e8a30d5f4f0c8 24-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Put the mechanism in place to track modifications in an AST entity that were committed after
its initial creation/deserialization and store the changes in a chained PCH.

The idea is that the AST entities call methods on the ASTMutationListener to give notifications
of changes; the PCHWriter implements the ASTMutationListener interface and stores the incremental changes
of the updated entity. WIP

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117235 91177308-0d34-0410-b5e6-96231b3b80d8
36d2fd44bfeec417bbd7465218353abb8bf7e95d 14-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Store in PCH the key function of C++ class to avoid deserializing the complete declaration context in order to compute it.
Progress for rdar://7260160.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116508 91177308-0d34-0410-b5e6-96231b3b80d8
2a984cad5ac3fdceeff2bd99daa7b90979313475 12-Oct-2010 John McCall <rjmccall@apple.com> Add some infrastructure for dealing with expressions of 'placeholder' type,
i.e. expressions with an internally-convenient type which should not be
appearing in generally valid, complete ASTs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116281 91177308-0d34-0410-b5e6-96231b3b80d8
14e0e7436cf6650a72052baea1f8ebe644cef489 02-Oct-2010 Chris Lattner <sabre@nondot.org> enhance ASTContext::GetBuiltinType to return a bitmask indicating which arguments
are required to be ICE's. No clients of this new functionality yet!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115366 91177308-0d34-0410-b5e6-96231b3b80d8
745da3a5bb4ea35f93f50301e7fbbb7d78d3b6bb 24-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Patch implements passing arrays to functions expecting
vla. Implements pr7827.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114737 91177308-0d34-0410-b5e6-96231b3b80d8
78a916ec5ff5b66adec3c499e1b9af7b87668309 22-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement -Wpadded and -Wpacked.

-Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556)
-Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect
on the layout or the size of the struct. Such structs may be mis-aligned for little benefit.

The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder.
To avoid calculating the layouts of all structs regardless of whether they are needed or not,
I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings
will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only:

$ cat t.c
struct S {
char c;
int i;
void f(struct S* s) {}

$ clang -fsyntax-only -Wpadded t.c
$ clang -c -Wpadded t.c -o t.o
t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded]
int i;
1 warning generated.

This is a good tradeoff between providing the warnings and not calculating layouts for all
structs in case the user has enabled a couple of rarely used warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114544 91177308-0d34-0410-b5e6-96231b3b80d8
6320064d0c60fa8683f5623881c9394fd4aa7689 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Heap-allocate the attribute vectors in
ASTContext::DeclAttrs. Otherwise, iterators will go stale when the
DenseMap reallocates, which can cause crashes when, e.g., looping over
the attributes in a template to instantiate them and add the results
to the instantiation of that template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112488 91177308-0d34-0410-b5e6-96231b3b80d8
3cdee121daa13403335094ce0e181b9911c2124c 26-Aug-2010 Douglas Gregor <dgregor@apple.com> When code-completing a potential call to a C++ non-static member
function, take into account the qualifiers on the object argument
(e.g., what will become "this"), filtering around uncallable member
functions and giving a slight priority boost to those with
exactly-matching qualifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112193 91177308-0d34-0410-b5e6-96231b3b80d8
ff75dfde6a351c57f41366d309c0bd11aba69bce 25-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make sure CXXABI is destroyed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112004 91177308-0d34-0410-b5e6-96231b3b80d8
000835d0b04345c0014c603fe6339b3bc154050e 23-Aug-2010 Fariborz Jahanian <fjahanian@apple.com> Support for IRGen of synthesize bitfield ivars in
objc-nonfragile-abi2 (radar 7824380).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111823 91177308-0d34-0410-b5e6-96231b3b80d8
2c18bb7c9fca66c30b6eabbdcbc6399d24a54fa9 20-Aug-2010 Fariborz Jahanian <fjahanian@apple.com> objective-c ivar refactoring patch. Iterations
over ivars for a varienty of puposes is now
consolidated into two small routines; DeepCollectObjCIvars
and ShallowCollectObjCIvars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111679 91177308-0d34-0410-b5e6-96231b3b80d8
cf807c4dfdb23e8fa3f400e0b24ef5b79db7a530 19-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Generate Attr subclasses with TableGen.

Now all classes derived from Attr are generated from TableGen.
Additionally, Attr* is no longer its own linked list; SmallVectors or
Attr* are used. The accompanying LLVM commit contains the updates to
TableGen necessary for this.

Some other notes about newly-generated attribute classes:

- The constructor arguments are a SourceLocation and a Context&,
followed by the attributes arguments in the order that they were
defined in Attr.td

- Every argument in Attr.td has an appropriate accessor named getFoo,
and there are sometimes a few extra ones (such as to get the length
of a variadic argument).

Additionally, specific_attr_iterator has been introduced, which will
iterate over an AttrVec, but only over attributes of a certain type. It
can be accessed through either Decl::specific_attr_begin/end or
the global functions of the same name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111455 91177308-0d34-0410-b5e6-96231b3b80d8
4087f27e5416c799bcb6be072f905be752acb61c 18-Aug-2010 Daniel Dunbar <daniel@zuster.org> StringRef'ication of lots stuff, patch by Peter Davies!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111314 91177308-0d34-0410-b5e6-96231b3b80d8
071cc7deffad608165b1ddd5263e8bf181861520 16-Aug-2010 Charles Davis <cdavis@mines.edu> Implement support for member pointers under the Microsoft C++ ABI in the
AST library.

This also adds infrastructure for supporting multiple C++ ABIs in the AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111117 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
deacbdca554298ccdf636f19c6094a8825ec6b34 11-Aug-2010 Douglas Gregor <dgregor@apple.com> Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,
and create separate decl nodes for forward declarations and the
definition," which appears to be causing significant Objective-C

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110803 91177308-0d34-0410-b5e6-96231b3b80d8
74c730ad1f6818b676b0bad46d806a9176950328 09-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for forward declarations and the definition.
- Eagerly create ObjCInterfaceTypes for declarations.
- The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another.
- Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110610 91177308-0d34-0410-b5e6-96231b3b80d8
569c3166874324c24011f8ade6978421f0d39b3c 07-Aug-2010 Douglas Gregor <dgregor@apple.com> Allow reference binding of a reference of Objective-C object type to
an lvalue of another, compatible Objective-C object type (e.g., a
subclass). Introduce a new initialization sequence step kind to
describe this binding, along with a new cast kind. Fixes PR7741.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110513 91177308-0d34-0410-b5e6-96231b3b80d8
255210ef415b9893f0e3794e8d9a704194c12f3c 06-Aug-2010 Douglas Gregor <dgregor@apple.com> Introduce implicit conversions between AltiVec vectors and GCC
vectors, from Anton Yartsev!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110437 91177308-0d34-0410-b5e6-96231b3b80d8
4ac7c0bb39696e92fd220118fedc484c09a69870 29-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Change the name to something less terrible; suggestion by Doug. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109797 91177308-0d34-0410-b5e6-96231b3b80d8
90e99a84ddd020e8fda79643748243725a2ed071 29-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,

This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl
needs to be deserialized during PCH loading for codegen purposes.
Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext,
thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen.

This fixes current (and avoids future) codegen-from-PCH bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109784 91177308-0d34-0410-b5e6-96231b3b80d8
447234dd459a00a5ed9b7c3e066162cd7a75bf2d 29-Jul-2010 Douglas Gregor <dgregor@apple.com> Allow a looser form of compatibility checking (which ignores
qualifiers) when checking a K&R function definition against a previous
prototype. Fixes <rdar://problem/8193107>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109751 91177308-0d34-0410-b5e6-96231b3b80d8
63fe86bee66fc145942c56b2cc564ea0b9b9ea12 25-Jul-2010 Douglas Gregor <dgregor@apple.com> Make ASTContext always use the BumpPtrAllocator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109375 91177308-0d34-0410-b5e6-96231b3b80d8
a8f8dac6a29f6d33474a38a32ce9dd859b696da9 20-Jul-2010 Fariborz Jahanian <fjahanian@apple.com> Patch to type match comparing Objective-C Classes which implement
protocols (Radar 8191774).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108758 91177308-0d34-0410-b5e6-96231b3b80d8
400f5125e2432d648f2c8a31b36a7f318a880c47 04-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix a regression of a previous commit of mine (rdar://8158953).

Some of the invariant checks for creating Record/Enum types don't hold true during PCH reading.
Introduce more suitable ASTContext::getRecordType() and getEnumType().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107598 91177308-0d34-0410-b5e6-96231b3b80d8
c91e9f439ae85d5f79a6b65672f1d7d1b55ccda0 04-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write more information of ASTContext for PCH. Overriden methods and instantiated-from information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107597 91177308-0d34-0410-b5e6-96231b3b80d8
006113841bdae1edb77aef75ba1ffdf2e55a3094 04-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.

Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107595 91177308-0d34-0410-b5e6-96231b3b80d8
9421adc43891e272156fab640e5d5ee5054b779c 04-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write specialization info of static data members for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107593 91177308-0d34-0410-b5e6-96231b3b80d8
1827403a7138946305c0058f262e02b595cf882f 03-Jul-2010 Douglas Gregor <dgregor@apple.com> Lazily declare default constructors. We now delay the construction of
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:

4/159 implicit default constructors created
18/236 implicit copy constructors created
70/241 implicit copy assignment operators created
0/173 implicit destructors created

And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107551 91177308-0d34-0410-b5e6-96231b3b80d8
225843186e3972ce798d3de00f86da9008b15a0e 03-Jul-2010 Douglas Gregor <dgregor@apple.com> Lazily declare implicit copy constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107543 91177308-0d34-0410-b5e6-96231b3b80d8
a376d10acfacf19d6dfa41069f7929739a18dd7a 02-Jul-2010 Douglas Gregor <dgregor@apple.com> Lazily declare copy-assignment operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107521 91177308-0d34-0410-b5e6-96231b3b80d8
4923aa25eb39d64106a5817c02d560a3aecf8b2c 02-Jul-2010 Douglas Gregor <dgregor@apple.com> Lazily declare the implicitly-declared destructor in a C++ class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107510 91177308-0d34-0410-b5e6-96231b3b80d8
9763e221e16026ddf487d2564ed349d2c874a1a1 02-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> - Allow a typedef type to be read from PCH even if its decl is currently initializing.
- Fix creation of TemplateSpecializationType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107471 91177308-0d34-0410-b5e6-96231b3b80d8
fe8ec01bba74f6841576a2ee93d2c62cdfa4eff2 29-Jun-2010 Jeffrey Yasskin <jyasskin@google.com> Delete assert in ComputeKeyFunction. The function runs fine without it, since
there's an explicit guard on isPolymorphic, and virtual bases don't affect the
key function calculation. This allows people to call
ASTContext::getKeyFunction on arbitrary classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107143 91177308-0d34-0410-b5e6-96231b3b80d8
788b0fd67e1992f23555454efcdb16a19dfefac3 23-Jun-2010 Chris Lattner <sabre@nondot.org> improve altivec vector bool/pixel support, patch by Anton Yartsev
with several tweaks by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106619 91177308-0d34-0410-b5e6-96231b3b80d8
f057bf78a69d37ee511430c88852a85eea19ad15 18-Jun-2010 Ted Kremenek <kremenek@apple.com> Change two static variables into instance variables of ASTContext. This allows us to have multiple copies
of ASTContext at the same time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106258 91177308-0d34-0410-b5e6-96231b3b80d8
3e1274f2b99cb99c03cc8e2c6517c37d330b597a 16-Jun-2010 Douglas Gregor <dgregor@apple.com> Canonicalize template template parameters when canonicalizing a
template name that refers to such a parameter. It's amazing that this
problem didn't surface earlier. Fixes PR7387.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106147 91177308-0d34-0410-b5e6-96231b3b80d8
efed5c832de630715dd42211dd3b2aab5dd97a1b 16-Jun-2010 Douglas Gregor <dgregor@apple.com> Revert r106099; it broke self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106100 91177308-0d34-0410-b5e6-96231b3b80d8
6cd8087e66d706f2317865f86c865fd9bc6969c9 16-Jun-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Added TemplateTypeParmType::getDecl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106099 91177308-0d34-0410-b5e6-96231b3b80d8
71d74bc0d6e522ce7c21a599db8e19d3883b518f 13-Jun-2010 John McCall <rjmccall@apple.com> TemplateSpecializationType's isCurrentInstantiation bit can be derived
from its canonical type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105912 91177308-0d34-0410-b5e6-96231b3b80d8
ef99001908e799c388f1363b1e607dad5f5b57d3 11-Jun-2010 John McCall <rjmccall@apple.com> Don't store ASTContext references in the TST nodes just to support profiling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105820 91177308-0d34-0410-b5e6-96231b3b80d8
33500955d731c73717af52088b7fc0e7a85681e7 11-Jun-2010 John McCall <rjmccall@apple.com> Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.

Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105801 91177308-0d34-0410-b5e6-96231b3b80d8
5a57efd7bf88a4a13018e0471ded8063a4abe8af 09-Jun-2010 Douglas Gregor <dgregor@apple.com> Tweak our handling of the notion of a standard conversion sequence
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105678 91177308-0d34-0410-b5e6-96231b3b80d8
bf1a028246d884a540aeafa38e89be59a269b072 05-Jun-2010 John McCall <rjmccall@apple.com> Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.
This is never null, but the associated type might be.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105503 91177308-0d34-0410-b5e6-96231b3b80d8
0054531488928a424666ac11fcdc6bcc5112de52 23-May-2010 Douglas Gregor <dgregor@apple.com> Keep track of all of the class and function template's "common"
pointers in the ASTContext, so that the folding sets stored inside
them will be deallocated when the ASTContext is destroyed (under
-disable-free). <rdar://problem/7998824>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104465 91177308-0d34-0410-b5e6-96231b3b80d8
ea1471e0e967548c596a71469702f8846dbaf3c0 20-May-2010 John McCall <rjmccall@apple.com> Support implicitly closing on 'this' in a block. Fixed PR7165.

(the codegen works here, too, but that's annoying to test without execution)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104202 91177308-0d34-0410-b5e6-96231b3b80d8
2390a72a3ebd37737fec5ba1385db9c3bb22fc59 19-May-2010 Fariborz Jahanian <fjahanian@apple.com> Adds support for ObjC++'s GC attribute on declaration of
object variables and functions returning such objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104168 91177308-0d34-0410-b5e6-96231b3b80d8
c12c5bba6ceb6acd4e51e7a0fc03257da9cfd44e 15-May-2010 John McCall <rjmccall@apple.com> Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
one of {primitive-id, primitive-Class, user-defined @class}
a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared). ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet. Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103870 91177308-0d34-0410-b5e6-96231b3b80d8
465d41b92b2c862f3062c412a0538db65c6a2661 11-May-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Merged Elaborated and QualifiedName types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103517 91177308-0d34-0410-b5e6-96231b3b80d8
ac9590effa90406767a544005ed1de52e258306b 10-May-2010 Ted Kremenek <kremenek@apple.com> Start converting pieces of DeclarationNameTable to be allocated using ASTContext's allocator.
While DeclarationNameTable doesn't leak, it uses 'malloc' too often. Start with having
'CXXLiteralOperatorNames' allocated using ASTContext's allocator and add a 'DoDestroy()' method
to DeclarationNameTable that is called by ~ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103426 91177308-0d34-0410-b5e6-96231b3b80d8
786cd154f2a48d2b464679d33fcd5df0cd794c06 27-Apr-2010 Fariborz Jahanian <fjahanian@apple.com> Move CollectIvarsToConstructOrDestruct to Sema
from AST, consider ivar array of objects
(per Doug's comment).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102446 91177308-0d34-0410-b5e6-96231b3b80d8
31f17ecbef57b5679c017c375db330546b7b5145 27-Apr-2010 John McCall <rjmccall@apple.com> Make the InjectedClassNameType the canonical type of the current instantiation
of a class template or class template partial specialization. That is to
say, in
template <class T> class A { ... };
template <class T> class B<const T*> { ... };
make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType
when written inside the appropriate context. This allows us to track the
current instantiation appropriately even inside AST routines. It also allows
us to compute a DeclContext for a type much more efficiently, at some extra
cost every time we write a template specialization (which can be optimized,
but I've left it simple in this patch).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102407 91177308-0d34-0410-b5e6-96231b3b80d8
184d7900e0202ac468710b731e42075129bb6000 27-Apr-2010 Fariborz Jahanian <fjahanian@apple.com> New method to construct/destruct ivars that have non-trivial default
constructors or destructors, not used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102403 91177308-0d34-0410-b5e6-96231b3b80d8
046861b912ed72bdc364d7905180ee63e5b08870 23-Apr-2010 Anders Carlsson <andersca@mac.com> Turn CXXMethodVector into a generic class template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102208 91177308-0d34-0410-b5e6-96231b3b80d8
2bb5ddaff86ee73d2cea7ec1835978afc88a83f0 23-Apr-2010 Fariborz Jahanian <fjahanian@apple.com> More work toward implementing
NeXt's -fno-constant-cfstrings - wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102189 91177308-0d34-0410-b5e6-96231b3b80d8
bf9e48cbaaa23d990dbedf9489513500bd0b9751 08-Apr-2010 Daniel Dunbar <daniel@zuster.org> AST: Move C++ record layout dumping to ASTContext::DumpRecordLayout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100746 91177308-0d34-0410-b5e6-96231b3b80d8
4a2023f5014e82389d5980d307b89c545dbbac81 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Extend DependentNameType with a keyword enum that specifies whether
this was parsed as a typename-specifier, elaborated-type-specifier
(including the kind), or just a dependent qualified type name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100039 91177308-0d34-0410-b5e6-96231b3b80d8
4714c12a1ab759156b78be8f109ea4c12213af57 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Rename TypenameType to DependentNameType in anticipation of some
refactoring work in this area.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100019 91177308-0d34-0410-b5e6-96231b3b80d8
425ef72306d4ff6b3698b744353e5f0e56b4b884 31-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Remember the regparm attribute in FunctionType::ExtInfo.
Fixes PR3782.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99940 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
fe6b2d481d91140923f4541f273b253291884214 30-Mar-2010 Douglas Gregor <dgregor@apple.com> Optimize PartialDiagnostic's memory-allocation behavior by placing a
cache of PartialDiagnostic::Storage objects into an allocator within
the ASTContext. This eliminates a significant amount of malloc
traffic, for a 10% performance improvement in -fsyntax-only wall-clock
time with 403.gcc's combine.c.

Also, eliminate the RequireNonAbstractType hack I put in earlier,
which was but a symptom of this larger problem.

Fixes <rdar://problem/7806091>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99849 91177308-0d34-0410-b5e6-96231b3b80d8
6a6aa53ec6c89ae0881309b0a0dd84b6868b576b 29-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Make default arguments to getFunctionNoProtoType an all or nothing option (as they already are in practise).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99785 91177308-0d34-0410-b5e6-96231b3b80d8
0c01d18094100db92d38daa923c95661512db203 24-Mar-2010 John McCall <rjmccall@apple.com> Implement a framework for the delay of arbitrary diagnostics within
templates. So delay access-control diagnostics when (for example) the target
of a friend declaration is a specific specialization of a template.

I was surprised to find that this was required for an access-controlled selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99383 91177308-0d34-0410-b5e6-96231b3b80d8
3bfacdf6f0706987c1b33c625cd68fb880881c22 22-Mar-2010 Fariborz Jahanian <fjahanian@apple.com> More clean up of ivars which are either in class extensions and
implementation or synthesized into an implementation. Also,
fixes a code gen. bug when ivars are itroduced in interleaved
implementations. (related to radar 7547942).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99193 91177308-0d34-0410-b5e6-96231b3b80d8
c6fbbedb3e90ff2f04828c36fd839e01468679f5 19-Mar-2010 Douglas Gregor <dgregor@apple.com> Remove the capture, serialization, and deserialization of comment
ranges as part of the ASTContext. This code is not and was never used,
but contributes ~250k to the size of the Cocoa.h precompiled

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99007 91177308-0d34-0410-b5e6-96231b3b80d8
f4e689b8528770001f4792f1f4ebdfb09d859e3d 17-Mar-2010 Douglas Gregor <dgregor@apple.com> Reduce the default alignment for ASTContext and Stmt/Expr allocation
from 16 bytes to 8 bytes, since we don't ever use those low 4
bits. Should save some storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98754 91177308-0d34-0410-b5e6-96231b3b80d8
132f2a2da34f378fc675b9e174564b0f52c31d98 17-Mar-2010 Fariborz Jahanian <fjahanian@apple.com> objective-c patch to provide type safty when blocks are passing or
returning objc objects. There will be a corresponding objective-c++
patch soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98696 91177308-0d34-0410-b5e6-96231b3b80d8
f715ca12bfc9fddfde75f98a197424434428b821 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
aea67dbd653a2dd6dd5cc2159279e81e855b2482 15-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.

Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98585 91177308-0d34-0410-b5e6-96231b3b80d8
7d2aa11c5c3b85a9d727ff868de666ba3bff5b59 11-Mar-2010 Ted Kremenek <kremenek@apple.com> For ivars created using @synthesize, set their DeclContext to be
the @implementation (instead of the @interface) and actually add
the ivar to the DeclContext (which we weren't doing before).

This allows us to simplify ASTContext::CollectNonClassIvars() by
removing ASTContext::CollectProtocolSynthesizedIvars(). Now all
ivars can be found by either inspecting the ObjCInterfaceDecl and
its companion ObjCImplementationDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98280 91177308-0d34-0410-b5e6-96231b3b80d8
becb8d5a6ab5103393eac5344ae69bcb860601dd 10-Mar-2010 John McCall <rjmccall@apple.com> Allow the fast path through ASTContext::getTypeDeclType to be inlined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98138 91177308-0d34-0410-b5e6-96231b3b80d8
3cb0ebd5f76abcb776f7cb4062bd79e3268c0dc4 10-Mar-2010 John McCall <rjmccall@apple.com> Create a new InjectedClassNameType to represent bare-word references to the
injected class name of a class template or class template partial specialization.
This is a non-canonical type; the canonical type is still a template
specialization type. This becomes the TypeForDecl of the pattern declaration,
which cleans up some amount of code (and complicates some other parts, but

Fixes PR6326 and probably a few others, primarily by re-establishing a few
invariants about TypeLoc sizes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98134 91177308-0d34-0410-b5e6-96231b3b80d8
a42286486c85402c65f9d30df17e6b1b037a6ade 05-Mar-2010 Fariborz Jahanian <fjahanian@apple.com> Patch to build qualifier on objective-c
pointer types. Fixes radar 7626768.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97847 91177308-0d34-0410-b5e6-96231b3b80d8
e4687ef4b9c72e1c476fce27d0abc1a2f78f739c 03-Mar-2010 Douglas Gregor <dgregor@apple.com> Initialize your storage, dummy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97615 91177308-0d34-0410-b5e6-96231b3b80d8
7d10b7eb670b821741b4c96f6cf7afbc3bb39abe 03-Mar-2010 Douglas Gregor <dgregor@apple.com> Eliminate the static map of overridden C++ methods, which was going to
come back to bite us at some point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97607 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
11062e11236b7bc689dad150e8b490fd6b063ec3 19-Feb-2010 Fariborz Jahanian <fjahanian@apple.com> Patch removes IVars list from ObjCInterfaceDecl and
instead relies on their DeclContext for iteration, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96638 91177308-0d34-0410-b5e6-96231b3b80d8
19c8576b7328f4dc2d07682f5da552875c1912ef 16-Feb-2010 John McCall <rjmccall@apple.com> Make the various type-decl Types (and their associated ASTContext routines)
accept const decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96325 91177308-0d34-0410-b5e6-96231b3b80d8
432a8893f7e30d141d7f279bd00b741a3cdac81f 12-Feb-2010 Fariborz Jahanian <fjahanian@apple.com> Patch to fix a warning which exposed a bug in building
a qualified objective-c pointer type. Fixes radar 7638810.
(Also removes a FIXME).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96003 91177308-0d34-0410-b5e6-96231b3b80d8
3478eb6872d836600caf45b0f81c2065d685d6e0 11-Feb-2010 Ted Kremenek <kremenek@apple.com> Have ~ASTContext() delete StoredDeclsMap (internal to DeclContext) by
storing the set of StoredDeclsMaps in an internal vector of void*.
This isn't an ideal solution, but for the time being this fixes a
major memory leak with these DenseMaps not being freed.

Fixes: <rdar://problem/7634755>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95861 91177308-0d34-0410-b5e6-96231b3b80d8
04a67a6aa3dfdc92d57f7f8d93ba397348c868a4 05-Feb-2010 John McCall <rjmccall@apple.com> Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95436 91177308-0d34-0410-b5e6-96231b3b80d8
82287d19ded35248c4ce6a425ce74116a13ce44e 05-Feb-2010 John Thompson <John.Thompson.JTSoftware@gmail.com> First stage of adding AltiVec support

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95335 91177308-0d34-0410-b5e6-96231b3b80d8
8b752f10c394b140f9ef89e049cbad1a7676fc25 27-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94681 91177308-0d34-0410-b5e6-96231b3b80d8
16e20cce43385001f33f8e3f90ee345609c805d1 26-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Correct cut-and-paste error in doxygen comment for newly introduced

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94553 91177308-0d34-0410-b5e6-96231b3b80d8
86fa4311c8a330957ff5b765fbb0a7750ecd38c9 26-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Add getTypeAlignInChars() for use in code that works in alignments in character

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94552 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
ab8bbf4ebd3e3e6eab913cb044772a62b7581941 18-Jan-2010 Douglas Gregor <dgregor@apple.com> Encoding calling conventions in the type system, from Charles Davis!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93726 91177308-0d34-0410-b5e6-96231b3b80d8
5535c38a2fcface6c13bc8bbeca66882de2fa227 12-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Fix the CodeGen half of PR5911 by changing reference initialization to
correctly look through arrays to see cv-qualifiers. Also enhances the routine
for doing this to preserve more type sugaring for diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93252 91177308-0d34-0410-b5e6-96231b3b80d8
aa8741a1db98eef05f09b1200dba94aa5dc3bc3d 11-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Change return type of getObjCEncodingTypeSize() to CharUnits as the units are in characters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93171 91177308-0d34-0410-b5e6-96231b3b80d8
442471309fa97348f849687a6a8ef4acc3bc2c1f 04-Jan-2010 Douglas Gregor <dgregor@apple.com> Make sure to use ASTContext::getAs*ArrayType() when decomposing array
types. Fixes APFloat.cpp compilation failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92523 91177308-0d34-0410-b5e6-96231b3b80d8
28e318cc6008c2bc008f0caee70dc736a03d6289 29-Dec-2009 Chandler Carruth <chandlerc@gmail.com> Correctly refer to element CVR qualifications when determining if a type is
more or less cv-qualified than another during implicit conversion and overload
resolution ([basic.type.qualifier] p5). Factors the logic out of template
deduction and into the ASTContext so it can be shared.

This fixes several aspects of PR5542, but not all of them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92248 91177308-0d34-0410-b5e6-96231b3b80d8
f5f7d864f5067d1ea4bff7fcf41b53a43b7b48ba 29-Dec-2009 Anders Carlsson <andersca@mac.com> Get rid of FixedWidthIntType, as suggested by Chris and Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92246 91177308-0d34-0410-b5e6-96231b3b80d8
0235d1510d0677b26f2d0448694e5e3e8a1ee043 25-Dec-2009 Benjamin Kramer <benny.kra@googlemail.com> Make sure operator new[] and operator delete[] match. This will hopefully silence 3 remaining MSVC warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92163 91177308-0d34-0410-b5e6-96231b3b80d8
bdc601b196c48d4cd56a5ceb45d41ae4e87371ab 22-Dec-2009 Ken Dyck <ken.dyck@onsemi.com> Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file to
avoid #including CharUnits.h in ASTContext.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91903 91177308-0d34-0410-b5e6-96231b3b80d8
4273f7068f16863f2469b45a3f00c3b4217bdbb4 18-Dec-2009 Ken Dyck <ken.dyck@onsemi.com> Change the return type of ASTContext::getTypeSizeInChars() from uint64_t to the
new opaque value type, CharUnits. This will help us avoid accidentally mixing
quantities that are in bit and character units.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91689 91177308-0d34-0410-b5e6-96231b3b80d8
cc906ef220c9be2644ad942457766d46a0b3651e 18-Dec-2009 Ken Dyck <ken.dyck@onsemi.com> Rename getByteSize() and getTypeSizeInBytes() in ASTContext to getCharWidth()
and getTypeSizeInChars() to reflect their basis in character type units, not
that of a possibly independent architecture-specific byte.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91688 91177308-0d34-0410-b5e6-96231b3b80d8
a3ccda58913cc1a4b8564e349448b12acc462da7 12-Dec-2009 Anders Carlsson <andersca@mac.com> Factor operator new declaration checking out into a separate function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91189 91177308-0d34-0410-b5e6-96231b3b80d8
43c79c2b07abc7ba6d9f243b84ee6539de4d2652 09-Dec-2009 Douglas Gregor <dgregor@apple.com> Implemented an implicit conversion from "noreturn" function types (and
pointers thereof) to their corresponding non-noreturn function
types. This conversion is considered an exact match for
overload-resolution purposes. Note that we are a little more strict
that GCC is, because we encode noreturn in the type system, but that's
a Good Thing (TM) because it does not allow us to pretend that
potentially-returning function pointers are non-returning function

Fxies PR5620.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90913 91177308-0d34-0410-b5e6-96231b3b80d8
f53df2398e07d13be9962b95aebc19b31706fa33 07-Dec-2009 Anders Carlsson <andersca@mac.com> Move key functions to a separate map.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90745 91177308-0d34-0410-b5e6-96231b3b80d8
a93c934af4fbf97cbe8e649d82e68ccacfe57c95 07-Dec-2009 John McCall <rjmccall@apple.com> DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables,
but the results are imperfect.

For posterity, I did:

cat <<EOF > $cmdfile

find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \;
find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \;
find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90743 91177308-0d34-0410-b5e6-96231b3b80d8
ed97649e9574b9d854fa4d6109c9333ae0993554 04-Dec-2009 John McCall <rjmccall@apple.com> Fix "using typename" and the instantiation of non-dependent using declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90614 91177308-0d34-0410-b5e6-96231b3b80d8
0bd6feb9e9d40fc889fd47e899985125a43dfed8 02-Dec-2009 John McCall <rjmccall@apple.com> Push overloaded function templates through the parser using a totally different
leaked data structure than before. This kills off the last remaining
explicit uses of OverloadedFunctionDecl in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90306 91177308-0d34-0410-b5e6-96231b3b80d8
369a3bd9979cf529eed529aa037de713c213e47d 26-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Allow user re-definition of SEL as well as accessing its fields.
This fixes pr5611.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89895 91177308-0d34-0410-b5e6-96231b3b80d8
80ad16f4b2b350ddbaae21a52975e63df5aafc2c 24-Nov-2009 John McCall <rjmccall@apple.com> Helper function for turning a TemplateName into a DeclarationName.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89782 91177308-0d34-0410-b5e6-96231b3b80d8
f5f514477d8a4e04e511d345b9fb896153f70e9d 24-Nov-2009 Ken Dyck <ken.dyck@onsemi.com> Add getByteSize() and getTypeSizeInBytes().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89760 91177308-0d34-0410-b5e6-96231b3b80d8
5d484e8cf710207010720589d89602233de61d01 23-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Intercept sizeof and alignof references before they get into ASTContext methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89668 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
13dcd00615de5c4279d97bdf63cd5f0a14fd9dcc 21-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> This patch implements objective-c's 'SEL' type as a built-in
type and fixes a long-standing code gen. crash reported in
at least two PRs and a radar. (radar 7405040 and pr5025).
There are couple of remaining issues that I would like for
Ted. and Doug to look at:

Ted, please look at failure in Analysis/MissingDealloc.m.
I have temporarily added an expected-warning to make the
test pass. This tests has a declaration of 'SEL' type which
may not co-exist with the new changes.

Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
I think the changes which I have ifdef'ed out are correct. They
need be considered for in a few Indexer/PCH test cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89561 91177308-0d34-0410-b5e6-96231b3b80d8
7ba107a1863ddfa1664555854f0d7bdb3c491c92 18-Nov-2009 John McCall <rjmccall@apple.com> Incremental progress on using declarations. Split UnresolvedUsingDecl into
two classes, one for typenames and one for values; this seems to have some
support from Doug if not necessarily from the extremely-vague-on-this-point
standard. Track the location of the 'typename' keyword in a using-typename
decl. Make a new lookup result for unresolved values and deal with it in
most places.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89184 91177308-0d34-0410-b5e6-96231b3b80d8
5e530af5d51572a0ed5dbe50da54bd333840c63d 17-Nov-2009 David Chisnall <csdavec@swan.ac.uk> Added block type introspection support.

As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89134 91177308-0d34-0410-b5e6-96231b3b80d8
a4923eb7c4b04d360cb2747641a5e92818edf804 16-Nov-2009 Douglas Gregor <dgregor@apple.com> First part of changes to eliminate problems with cv-qualifiers and
sugared types. The basic problem is that our qualifier accessors
(getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at
the current QualType and not at any qualifiers that come from sugared
types, meaning that we won't see these qualifiers through, e.g.,

typedef const int CInt;
typedef CInt Self;

Self.isConstQualified() currently returns false!

Various bugs (e.g., PR5383) have cropped up all over the front end due
to such problems. I'm addressing this problem by splitting each
qualifier accessor into two versions:

- the "local" version only returns qualifiers on this particular
QualType instance
- the "normal" version that will eventually combine qualifiers from this
QualType instance with the qualifiers on the canonical type to
produce the full set of qualifiers.

This commit adds the local versions and switches a few callers from
the "normal" version (e.g., isConstQualified) over to the "local"
version (e.g., isLocalConstQualified) when that is the right thing to
do, e.g., because we're printing or serializing the qualifiers. Also,
switch a bunch of

Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType()

expressions over to

Context.hasSameUnqualifiedType(T1, T2)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88969 91177308-0d34-0410-b5e6-96231b3b80d8
444be7366d0a1e172c0290a1ea54c1cb16b5947c 13-Nov-2009 Daniel Dunbar <daniel@zuster.org> Wherein the TargetInfo argument to Preprocessor is made 'const' and propogated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87087 91177308-0d34-0410-b5e6-96231b3b80d8
db0d4b751e83b8841b8f48f913f17e50467f13d4 12-Nov-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction for template template parameters. This
permits, among other things, ripping apart and reconstructing
templates via partial specialization:

template<typename T>
struct DeepRemoveConst { typedef T type; };

template<typename T>
struct DeepRemoveConst<const T> {
typedef typename DeepRemoveConst<T>::type type;

template<template<typename> class TT, typename T>
struct DeepRemoveConst<TT<T> > {
typedef TT<typename DeepRemoveConst<T>::type> type;

Also, fix a longstanding thinko in the code handling partial ordering
of class template partial specializations. We were performing the
second deduction without clearing out the results of the first
deduction. It's amazing we got through so much code with such a
horrendous error :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86893 91177308-0d34-0410-b5e6-96231b3b80d8
ca1bdd7c269a2390d43c040a60511edd017ee130 04-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement support for parsing dependent template-ids that refer to
overloaded operators, e.g.,

p->template operator+<T>()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85989 91177308-0d34-0410-b5e6-96231b3b80d8
d5925bdff8bda8e062985caea299946636104d99 03-Nov-2009 Ted Kremenek <kremenek@apple.com> Move 'static inline' functions GetNullarySelector() and GetUnarySelector() from CFRefCount.cpp to ASTContext.h. These functions are likely to be generally useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85886 91177308-0d34-0410-b5e6-96231b3b80d8
e23fa2d0e84d1b878e012442a726c664216a9adf 30-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> This patch computes composite type of two objective-c expressions
used in a conditional expression by finding the most-derived common
super class of the two and qualifies the resulting type by the
intersection of the protocl qualifier list of the two objective-c
pointer types. ( this is continuation of radar 7334235).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85554 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
db07b3f7cdcb505329c1280d7cf70791739a7cad 28-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Type of a conditional expression with two distinct objective-c
class pointer is the most derived common class of the two.
This is <rdar://problem/7334235>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85337 91177308-0d34-0410-b5e6-96231b3b80d8
e27ec8ad56dbf1efb2de004b90fbbb86f740e3f1 24-Oct-2009 John McCall <rjmccall@apple.com> Store the builtin types as CanQualTypes. Expand a bit on the CanQual API,
but also remove some methods that cause ambiguities, and generally
make CanQual<blah> more analogous to QualType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84976 91177308-0d34-0410-b5e6-96231b3b80d8
a4eb74d4dfe126c686dc708fec444c85ffb73b47 23-Oct-2009 John McCall <rjmccall@apple.com> Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
source info block with a single location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84970 91177308-0d34-0410-b5e6-96231b3b80d8
54e14c4db764c0636160d26c5bbf491637c83a76 23-Oct-2009 John McCall <rjmccall@apple.com> When building types from declarators, instead of building two types (one for
the DeclaratorInfo, one for semantic analysis), just build a single type whose
canonical type will reflect the semantic analysis (assuming the type is
well-formed, of course).

To make that work, make a few changes to the type system:
* allow the nominal pointee type of a reference type to be a (possibly sugared)
reference type. Also, preserve the original spelling of the reference type.
Both of these can be ignored on canonical reference types.
* Remove ObjCProtocolListType and preserve the associated source information on
the various ObjC TypeLocs. Preserve the spelling of protocol lists except in
the canonical form.
* Preserve some level of source type structure on parameter types, but
canonicalize on the canonical function type. This is still a WIP.

Drops code size, makes strides towards accurate source location representation,
slight (~1.7%) progression on Cocoa.h because of complexity drop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84907 91177308-0d34-0410-b5e6-96231b3b80d8
083c25eea14bb4cc4ecc3ec763c60e2e609e22bd 22-Oct-2009 Mike Stump <mrs@apple.com> Extend out the block descriptor structure for debug information with
the copy/dispose helpers as appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84817 91177308-0d34-0410-b5e6-96231b3b80d8
af7b44d847d3e44c43346d508b2e55a6254b6e9d 21-Oct-2009 Mike Stump <mrs@apple.com> Complete out debug info generation for captured __block variables. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84768 91177308-0d34-0410-b5e6-96231b3b80d8
ea26cb522e88fc86b0d1cae61dcefcfe4cc20231 21-Oct-2009 Mike Stump <mrs@apple.com> Prep work to always preallocate BlockDeclRefExprs so that we can
generate the debug information for the first parameter to the block
invoke functions. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84737 91177308-0d34-0410-b5e6-96231b3b80d8
109de5ead1dfcb3bc985cddb8cb3ed5bcecad88d 21-Oct-2009 John McCall <rjmccall@apple.com> Add TypeLocBuilder, an API for incrementally creating TypeLocs. Change
the API for creating DeclaratorInfos to allow callers to provide an exact

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84715 91177308-0d34-0410-b5e6-96231b3b80d8
adaaad3715c9c26cdcfdfe3401a13d7b4423ddcf 20-Oct-2009 Mike Stump <mrs@apple.com> Refine the type of the first parameter to block invoke functions.
WIP. I have yet to find the magic incantation to get the structure
type to be defined. If someone has a pointer, love to hear it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84590 91177308-0d34-0410-b5e6-96231b3b80d8
49a832bd499d6f61c23655f1fac99f0dd229756e 18-Oct-2009 John McCall <rjmccall@apple.com> When performing template-substitution into a type, don't just replace the
TemplateTypeParmType with the substituted type directly; instead, replace it
with a SubstTemplateTypeParmType which will note that the type was originally
written as a template type parameter. This makes it reasonable to preserve
source information even through template substitution.

Also define the new SubstTemplateTypeParmType class, obviously.

For consistency with current behavior, we stringize these types as if they
were the underlying type. I'm not sure this is the right thing to do.
At any rate, I paled at adding yet another clause to the don't-desugar 'if'
statement, so I extracted a function to do it. The new function also does
The Right Thing more often, I think: e.g. if we have a chain of typedefs
leading to a vector type, we will now desugar all but the last one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84412 91177308-0d34-0410-b5e6-96231b3b80d8
46a617a792bfab0d9b1e057371ea3b9540802226 16-Oct-2009 John McCall <rjmccall@apple.com> Remove the ConstantArrayType subtypes. This information is preserved in the
TypeLoc records for declarations; it should not be necessary to represent it
directly in the type system.

Please complain if you were using these classes and feel you can't replicate
previous functionality using the TypeLoc API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84222 91177308-0d34-0410-b5e6-96231b3b80d8
663b5a0be7261c29bc4c526a71cffcfa02d4153e 14-Oct-2009 Douglas Gregor <dgregor@apple.com> Testing and some minor fixes for explicit template instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84129 91177308-0d34-0410-b5e6-96231b3b80d8
251b4ff2578e26959a4c036140ccd61c5e9292f2 08-Oct-2009 Douglas Gregor <dgregor@apple.com> For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the
scope of the specialization and ensure that a specialization
declaration without an initializer is not a definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83533 91177308-0d34-0410-b5e6-96231b3b80d8
24fab41057e4b67ed69a6b4027d5ae0f2f6934dc 29-Sep-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce ObjCProtocolListType type subclass.

This is used only for keeping detailed type source information for protocol references,
it should not participate in the semantics of the type system.

Its protocol list is not canonicalized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83093 91177308-0d34-0410-b5e6-96231b3b80d8
fbbce49c116aa8c8c7c0707cb6048b55f70461a9 25-Sep-2009 Anders Carlsson <andersca@mac.com> Handle array fields that contain empty structs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82744 91177308-0d34-0410-b5e6-96231b3b80d8
0953e767ff7817f97b3ab20896b229891eeff45b 24-Sep-2009 John McCall <rjmccall@apple.com> Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 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
7da2431c23ef1ee8acb114e39692246e1801afc2 05-Sep-2009 John McCall <rjmccall@apple.com> Basic support for representing elaborated type specifiers
directly in the AST. The current thinking is to create these
only in C++ mode for efficiency. But for now, they're not being
created at all; patch to follow.

This will let us do things like verify that tags match during
template instantation, as well as signal that an elaborated type
specifier was used for clients that actually care.

Optimally, the TypeLoc hierarchy should be adjusted to carry tag
location information as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81057 91177308-0d34-0410-b5e6-96231b3b80d8
d8b285fee4471f393da8ee30f552ceacdc362afa 01-Sep-2009 Anders Carlsson <andersca@mac.com> Don't assert when instantiating member references to fields in anonymous structs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80657 91177308-0d34-0410-b5e6-96231b3b80d8
0d8df780aef1acda5962347a32591efc629b6748 29-Aug-2009 Anders Carlsson <andersca@mac.com> Improve instantiation of UnresolvedUsingDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80434 91177308-0d34-0410-b5e6-96231b3b80d8
0de78998e7bda473b408437053e48661b510d453 21-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> Introduce getConstantArrayElementCount API and use it in
construction/destruction of array members.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79637 91177308-0d34-0410-b5e6-96231b3b80d8
04e8357f6801e9ff52673e7e899a67bbabf9de93 20-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Fix bit-field promotion to be a bit closer to the behavior of gcc.
Patch by Enea Zaffanella, with some simplifications/corrections to
isPromotableBitField by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79510 91177308-0d34-0410-b5e6-96231b3b80d8
a95d75769edae299816ec7fd9bbcdf1ef617c5c9 19-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Make integer promotions work correctly on PIC16 and other platforms
where sizeof(short) == sizeof(int). Move UsualArithmeticConversionsType
out of Sema, since it was only there as a historical artifact. Patch by
Enea Zaffanella.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79412 91177308-0d34-0410-b5e6-96231b3b80d8
b17166c8077cd900cca83a895c43b30ea6660598 19-Aug-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce DeclaratorInfo and TypeLoc, intended to be used for storing and reading source information for types.

DeclaratorInfo will contain a flat memory block for source information about a type that came out of a declarator.
TypeLoc and its subclasses will be used by clients as wrappers to "traverse" the memory block and read the information.

Both DeclaratorInfo and TypeLoc are not utilized in this commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79391 91177308-0d34-0410-b5e6-96231b3b80d8
0f436560640a1cff5b6d96f80f540770f139453f 17-Aug-2009 David Chisnall <csdavec@swan.ac.uk> Initial patch to support definitions of id and Class from headers in Objective-C code.

This currently breaks test/SemaObjC/id-isa-ref.m and issues some spurious warnings when you attempt to assign a struct objc_class* value to a Class variable. The test case probably should fail as it's written, because without the definition of Class the compiler should not assume struct objc_class* is a valid receiver type, but it's left broken because it would be nice if we could get that passing too for the special case of isa.

Approved by snaroff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79248 91177308-0d34-0410-b5e6-96231b3b80d8
0fd8904c5f71a11d29f67716c3ebdf7ad1c855fb 12-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to warn if a property which is 'assign' by default
may not implement NSCopying protocol in -fobjc-gc[-only] mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78726 91177308-0d34-0410-b5e6-96231b3b80d8
e607ed068334bacb8d7b093996b4671c6ca79e25 07-Aug-2009 Mike Stump <mrs@apple.com> Fix some const_cast issues. This is the beginning of the rabbit hole.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78393 91177308-0d34-0410-b5e6-96231b3b80d8
50d62d1b4a98adbc83de8f8cd1379ea1c25656f7 05-Aug-2009 Douglas Gregor <dgregor@apple.com> Introduce the canonical type smart pointers, and use them in a few places to
tighten up the static type system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78164 91177308-0d34-0410-b5e6-96231b3b80d8
2ec09f1dc123e1942ed756e8ee4fef86451eac9e 31-Jul-2009 Douglas Gregor <dgregor@apple.com> Canonicalize dependent extended vector types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77663 91177308-0d34-0410-b5e6-96231b3b80d8
04d4beee4b86af20a9e4457023d3925cab8f9908 31-Jul-2009 Douglas Gregor <dgregor@apple.com> Build canonical types for dependently-sized array types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77647 91177308-0d34-0410-b5e6-96231b3b80d8
9d702ae1cd5cfa19d884cbef77e1df99395138bb 31-Jul-2009 Douglas Gregor <dgregor@apple.com> Canonicalization of dependent C++0x decltype types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77643 91177308-0d34-0410-b5e6-96231b3b80d8
b197572cf1cd70a817a1f546478cb2cb9112c48e 31-Jul-2009 Douglas Gregor <dgregor@apple.com> Canonicalization for dependent typeof(expr) types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77639 91177308-0d34-0410-b5e6-96231b3b80d8
d99cbe66403ee39c2ee58024b9582b95649a4fc5 29-Jul-2009 Douglas Gregor <dgregor@apple.com> [llvm up]

A template name can refer to a set of overloaded function
templates. Model this in TemplateName, which can now refer to an
OverloadedFunctionDecl that contains function templates. This removes
an unspeakable hack in Sema::isTemplateName.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77488 91177308-0d34-0410-b5e6-96231b3b80d8
f711c41dd9412a8182793259d355c4f6979ed5ed 29-Jul-2009 Mike Stump <mrs@apple.com> Some minor cleanups, thanks Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77402 91177308-0d34-0410-b5e6-96231b3b80d8
fd612dbb23cd31c03c898ae53ff18d0dfd8488f9 29-Jul-2009 Mike Stump <mrs@apple.com> Some style fixes, thanks Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77400 91177308-0d34-0410-b5e6-96231b3b80d8
1275ae098acda31fe0e434510c729fcfed0458a1 29-Jul-2009 Douglas Gregor <dgregor@apple.com> Refactor the code that produces a TemplateSpecializationType, so that
canonicalization for dependent TemplateSpecializationTypes occurs
within ASTContext::getTemplateSpecializationType. Also, move template
argument canonicalization into ASTContext::getCanonicalTemplateArgument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77388 91177308-0d34-0410-b5e6-96231b3b80d8
8fad9941a635a42ee644e7396ca84cbaaa5c1b6e 28-Jul-2009 Mike Stump <mrs@apple.com> Update comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77355 91177308-0d34-0410-b5e6-96231b3b80d8
782fa308a765aeac2acb39c4e697c937ec21185b 28-Jul-2009 Mike Stump <mrs@apple.com> Make longjmp a real builtin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77291 91177308-0d34-0410-b5e6-96231b3b80d8
2455636163fdd18581d7fdae816433f886d88213 25-Jul-2009 Mike Stump <mrs@apple.com> Add noreturn as a type attribute, handle printing for them and handle
calls to noreturn function pointers when CFG building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77089 91177308-0d34-0410-b5e6-96231b3b80d8
7caa6825f42a0f7e97d6fc06233133c42b218e46 24-Jul-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for static data members that are defined out-of-line.

Note that this also fixes a bug that affects non-template code, where we
were not treating out-of-line static data members are "file-scope" variables,
and therefore not checking their initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77002 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
4084c306635b70f37029dca938444e6013f08684 23-Jul-2009 Steve Naroff <snaroff@apple.com> Remove a bunch of FIXME's related to ObjC type checking.

- Move Sema::ObjCQualifiedIdTypesAreCompatible(), Sema::QualifiedIdConformsQualifiedId(), and a couple helper functions to ASTContext.
- Change ASTContext::canAssignObjCInterfaces() to use ASTContext:: ObjCQualifiedIdTypesAreCompatible().
- Tweak several test cases to accommodate the new/improved type checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76830 91177308-0d34-0410-b5e6-96231b3b80d8
8a1d722f13df383600f36d77f842957c8adb5f1b 21-Jul-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> - Introduce ASTContext::getObjCImplementation() and ASTContext::setObjCImplementation() which use a DenseMap to associate
an interface/category with its implementation (if one exists).

- Introduce ObjCInterfaceDecl::get/setImplementation() and ObjCCategoryDecl::get/setImplementation() that use the above methods.

- Add a compiler error for when a category is reimplemented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76508 91177308-0d34-0410-b5e6-96231b3b80d8
c15cb2af27514ecc879daba9aa01389c5203685d 18-Jul-2009 Steve Naroff <snaroff@apple.com> Remove ObjCQualifiedInterfaceType:-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76321 91177308-0d34-0410-b5e6-96231b3b80d8
97fbaa2a38804268a024f1a104b43fcf8b4411b0 18-Jul-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76274 91177308-0d34-0410-b5e6-96231b3b80d8
f49545602089be5b1f744e04326b8a566f6d8773 16-Jul-2009 Steve Naroff <snaroff@apple.com> Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76076 91177308-0d34-0410-b5e6-96231b3b80d8
c02397509bb4057f3a7d6f5f4d764d122ed2381f 15-Jul-2009 Steve Naroff <snaroff@apple.com> Remove default argument, since it isn't being used (suggested by Fariborz).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75815 91177308-0d34-0410-b5e6-96231b3b80d8
de2e22d33afec98324a66a358dfe0951b3c7259a 15-Jul-2009 Steve Naroff <snaroff@apple.com> Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).

This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).

This patch also adds Type::isObjCBuiltinType().

This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75808 91177308-0d34-0410-b5e6-96231b3b80d8
f5c209d23b20ada4a9b6235db50317239cbf6ae1 14-Jul-2009 Alisdair Meredith <public@alisdairm.net> Basic support for C++0x unicode types. Support for literals will follow in an incremental patch

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75622 91177308-0d34-0410-b5e6-96231b3b80d8
14108da7f7fc059772711e4ffee1322a27b152a7 11-Jul-2009 Steve Naroff <snaroff@apple.com> This patch includes a conceptually simple, but very intrusive/pervasive change.

The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time.

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75314 91177308-0d34-0410-b5e6-96231b3b80d8
c29f77b769bcc5b6dc85e72c8e3cc2e348e5cf25 07-Jul-2009 Douglas Gregor <dgregor@apple.com> Make ASTContext explicitly keep track of the declaration for the C
FILE type, rather than using name lookup to find FILE within the
translation unit. Within precompiled headers, FILE is treated as yet
another "special type" (like __builtin_va_list).

This change should provide a performance improvement (not verified),
since the lookup into the translation unit declaration
forces the (otherwise unneeded) construction of a large hash table.
More importantly, with precompiled headers, the construction
of that table requires deserializing most of the top-level
declarations from the precompiled header, which are then unused.

Fixes PR 4509.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74911 91177308-0d34-0410-b5e6-96231b3b80d8
7e7eb3da052a6d80ddf2377cab0384c798f73f75 06-Jul-2009 Douglas Gregor <dgregor@apple.com> Keep track of the Expr used to describe the size of an array type,
from Enea Zaffanella!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74831 91177308-0d34-0410-b5e6-96231b3b80d8
2e22253e03e175144aeb9d13350a12fd83f858be 02-Jul-2009 Douglas Gregor <dgregor@apple.com> Add support for retrieving the Doxygen comment associated with a given
declaration in the AST.

The new ASTContext::getCommentForDecl function searches for a comment
that is attached to the given declaration, and returns that comment,
which may be composed of several comment blocks.

Comments are always available in an AST. However, to avoid harming
performance, we don't actually parse the comments. Rather, we keep the
source ranges of all of the comments within a large, sorted vector,
then lazily extract comments via a binary search in that vector only
when needed (which never occurs in a "normal" compile).

Comments are written to a precompiled header/AST file as a blob of
source ranges. That blob is only lazily loaded when one requests a
comment for a declaration (this never occurs in a "normal" compile).

The indexer testbed now supports comment extraction. When the
-point-at location points to a declaration with a Doxygen-style
comment, the indexer testbed prints the associated comment
block(s). See test/Index/comments.c for an example.

Some notes:
- We don't actually attempt to parse the comment blocks themselves,
beyond identifying them as Doxygen comment blocks to associate them
with a declaration.
- We won't find comment blocks that aren't adjacent to the
declaration, because we start our search based on the location of
the declaration.
- We don't go through the necessary hops to find, for example,
whether some redeclaration of a declaration has comments when our
current declaration does not. Similarly, we don't attempt to
associate a \param Foo marker in a function body comment with the
parameter named Foo (although that is certainly possible).
- Verification of my "no performance impact" claims is still "to be

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74704 91177308-0d34-0410-b5e6-96231b3b80d8
683087ffcf21d2a22cd2d0424b7f119168b47a8e 29-Jun-2009 Steve Naroff <snaroff@apple.com> Remove ASTContext::getObjCQualifiedIdType().
Convert clients to use ASTContext::getObjCObjectPointerType().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74424 91177308-0d34-0410-b5e6-96231b3b80d8
e89d15944dd3be750a09805ad21222d2fa9321fa 26-Jun-2009 Anders Carlsson <andersca@mac.com> Implement enough of the 'auto' keyword so we can claim to support N2546.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74307 91177308-0d34-0410-b5e6-96231b3b80d8
395b475a4474f1c7574d927ad142ca0c7997cbca 24-Jun-2009 Anders Carlsson <andersca@mac.com> Add a DecltypeType type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74099 91177308-0d34-0410-b5e6-96231b3b80d8
68584ed35ad819a1668e3f527ba7f5dd4ae6a333 18-Jun-2009 Douglas Gregor <dgregor@apple.com> Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
d1b3c2dd5bc1f3103bee6137957aa7c5f8f2f0bc 18-Jun-2009 Steve Naroff <snaroff@apple.com> First step toward fixing <rdar://problem/6613046> refactor clang objc type representation.

Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).

This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types).

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73649 91177308-0d34-0410-b5e6-96231b3b80d8
9cdda0cf8528e3d595be9bfa002f0450074beb4d 17-Jun-2009 Douglas Gregor <dgregor@apple.com> Support dependent extended vector types and template instantiation
thereof. Patch by Anders Johnsen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73641 91177308-0d34-0410-b5e6-96231b3b80d8
76e4ce42a30cee4dc40ce7c6014874fbc4f9baa7 16-Jun-2009 Anders Carlsson <andersca@mac.com> Keep track of whether a type parameter type is a parameter pack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73452 91177308-0d34-0410-b5e6-96231b3b80d8
1b63e4f732dbc73d90abf886b4d21f8e3a165f6d 14-Jun-2009 Chris Lattner <sabre@nondot.org> Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc. This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73319 91177308-0d34-0410-b5e6-96231b3b80d8
6b15cdc1312f8fc45c86ee75e2a85106700e97f6 14-Jun-2009 Chris Lattner <sabre@nondot.org> move the various builtins stuff from libast to libbasic. This
fixes a layering violation in lib/Basic/Targets.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73318 91177308-0d34-0410-b5e6-96231b3b80d8
86df27bbdbb98c39ec2184695c0561209f91bedd 14-Jun-2009 Chris Lattner <sabre@nondot.org> move GetBuiltinType from Builtin::Context to ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73316 91177308-0d34-0410-b5e6-96231b3b80d8
26784c1dd1f3e395f024fd594646790421b3bbf3 08-Jun-2009 Eli Friedman <eli.friedman@gmail.com> Delete method which is now trivial.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73043 91177308-0d34-0410-b5e6-96231b3b80d8
8e6ac1d80055fa37b9b84029c7e751624ba7f84c 04-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Cleanup/Refactoring of ivar collection. No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72827 91177308-0d34-0410-b5e6-96231b3b80d8
d249e1d1f1498b81314459ceda19d6ff25c278ad 29-May-2009 Douglas Gregor <dgregor@apple.com> Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72590 91177308-0d34-0410-b5e6-96231b3b80d8
465226e23a3008bd68973513dda1f9e3cd27dbdd 28-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Reintroduce the home for exception specs, and make Sema fill it. However, keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72498 91177308-0d34-0410-b5e6-96231b3b80d8
9820074dd47d37681085e964cd3392ac0b3e67b9 12-May-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to implement ivar synthesis of properties declared in protocols
only and used in class imllementations (objc2 Nonfragile ABI specific).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71571 91177308-0d34-0410-b5e6-96231b3b80d8
7da97d0f31e1ec16998d3de2cfd2e88fe3736673 11-May-2009 Douglas Gregor <dgregor@apple.com> Implement the semantics of the injected-class-name within a class
template. The injected-class-name is either a type or a template,
depending on whether a '<' follows it. As a type, the
injected-class-name's template argument list contains its template
parameters in declaration order.

As part of this, add logic for canonicalizing declarations, and be
sure to canonicalize declarations used in template names and template

A TagType is dependent if the declaration it references is dependent.

I'm not happy about the rather complicated protocol needed to use

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71408 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
a15f7ac7729b74d1d8bef0c009b803a4bbef20d3 08-May-2009 Zhongxing Xu <xuzhongxing@gmail.com> Revert r71079.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71202 91177308-0d34-0410-b5e6-96231b3b80d8
25a3ef7cc5fd55dc8cc67c6e6770c8595657e082 07-May-2009 Douglas Gregor <dgregor@apple.com> Start canonicalizing template names. This is not yet complete, but it
improves type identity with dependent types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71152 91177308-0d34-0410-b5e6-96231b3b80d8
bfa2fcba545fb270f31205d616846c2bfaf4e47e 07-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Back out r70506 (exception spec in AST) again. We won't have exception specs until we've had a lot more discussion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71125 91177308-0d34-0410-b5e6-96231b3b80d8
33c37b9b87453c835cd0e32a4a65db329da20356 06-May-2009 Zhongxing Xu <xuzhongxing@gmail.com> add getTargetInfo() method to ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71079 91177308-0d34-0410-b5e6-96231b3b80d8
ee1ec39f54a759a1c0858b608e02d70e0d7f54bc 03-May-2009 Daniel Dunbar <daniel@zuster.org> Remove ASTContext::addRecordToClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70780 91177308-0d34-0410-b5e6-96231b3b80d8
b2dbbb99e12806eaaf53b7ccabc32f42b5719443 03-May-2009 Daniel Dunbar <daniel@zuster.org> Split out getASTObjCImplementationLayout
- The difference from getASTObjCInterfaceLayout is that the computes
the layout including synthesized ivars.

- No functionality change, they currently both compute the same thing
-- whether that includes synthesized ivars or not depends on when
they get called!!!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70690 91177308-0d34-0410-b5e6-96231b3b80d8
7b9a2ee5a4393001bdec7dec841eb7c811da492c 30-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make a home for exception specs in the AST. Now Sema can hook them up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70506 91177308-0d34-0410-b5e6-96231b3b80d8
2df9ced9fd1e8c7d7b38443db07e0e811de22571 30-Apr-2009 Chris Lattner <sabre@nondot.org> initial support for __[u]int128_t, which should be basically
compatible with VC++ and GCC. The codegen/mangling angle hasn't
been fully ironed out yet. Note that we accept int128_t even in
32-bit mode, unlike gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70464 91177308-0d34-0410-b5e6-96231b3b80d8
9f9bf258f8ebae30bfb70feb9d797d6eb67b0460 28-Apr-2009 Douglas Gregor <dgregor@apple.com> Improve compatibility with GCC regarding inline semantics in GNU89
mode and in the presence of __gnu_inline__ attributes. This should fix
both PR3989 and PR4069.

As part of this, we now keep track of all of the attributes attached
to each declaration even after we've performed declaration
merging. This fixes PR3264.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70292 91177308-0d34-0410-b5e6-96231b3b80d8
319ac896a0fef7365d5589b8021db7e41207fe42 24-Apr-2009 Douglas Gregor <dgregor@apple.com> PCH support for all of the predefined Objective-C types, such as id,
SEL, Class, Protocol, CFConstantString, and
__objcFastEnumerationState. With this, we can now run the Objective-C
methods and properties PCH tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69932 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
2deaea37a637dd01221d0cced343702a39d8132c 22-Apr-2009 Douglas Gregor <dgregor@apple.com> Lazy loading of builtins for precompiled headers.

PCH files now contain complete information about builtins, including
any declarations that have been synthesized as part of building the
PCH file. When using a PCH file, we do not initialize builtins at all;
when needed, they'll be found in the PCH file.

This optimization translations into a 9% speedup for "Hello, World!"
with Carbon.h as a prefix header and roughly a 5% speedup for 403.gcc
with its prefix header. We're also reading less of the PCH file for
"Hello, World!":

*** PCH Statistics:
286/20693 types read (1.382110%)
1630/59230 declarations read (2.751984%)
764/44914 identifiers read (1.701029%)
1/32954 statements read (0.003035%)
5/6187 macros read (0.080815%)

down from

*** PCH Statistics:
411/20693 types read (1.986179%)
2553/59230 declarations read (4.310316%)
1093/44646 identifiers read (2.448148%)
1/32954 statements read (0.003035%)
21/6187 macros read (0.339421%)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69815 91177308-0d34-0410-b5e6-96231b3b80d8
3b3a45858c6b2a45114e91902c3bf3c4b7f5f302 22-Apr-2009 Daniel Dunbar <daniel@zuster.org> Mark another TypeForDecl const and make getObjCInterfaceType's argument const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69772 91177308-0d34-0410-b5e6-96231b3b80d8
525c9b7baeeff022127cd1b167579f3bda73b3ed 21-Apr-2009 Daniel Dunbar <daniel@zuster.org> Kill ASTContext::[gs]etFieldForDecl, instead we just lookup things
when we need them -- which is exactly what some code was already
- No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69648 91177308-0d34-0410-b5e6-96231b3b80d8
153bfe5795e2c1a5a738e73d3784964e082237fc 20-Apr-2009 Daniel Dunbar <daniel@zuster.org> Make FieldDecl parameter to getObjCEncodingForType... const.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69578 91177308-0d34-0410-b5e6-96231b3b80d8
2cf2634ffdb4f7c8d46cef3f8e60a55993f1c57a 10-Apr-2009 Douglas Gregor <dgregor@apple.com> Implementation of pre-compiled headers (PCH) based on lazy
de-serialization of abstract syntax trees.

PCH support serializes the contents of the abstract syntax tree (AST)
to a bitstream. When the PCH file is read, declarations are serialized
as-needed. For example, a declaration of a variable "x" will be
deserialized only when its VarDecl can be found by a client, e.g.,
based on name lookup for "x" or traversing the entire contents of the
owner of "x".

This commit provides the framework for serialization and (lazy)
deserialization, along with support for variable and typedef
declarations (along with several kinds of types). More
declarations/types, along with important auxiliary structures (source
manager, preprocessor, etc.), will follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68732 91177308-0d34-0410-b5e6-96231b3b80d8
6ab3524f72a6e64aa04973fa9433b5559abb3525 09-Apr-2009 Douglas Gregor <dgregor@apple.com> Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
fb523e16dd1f860ff02a3ae03e5e3e25327a5860 03-Apr-2009 Chris Lattner <sabre@nondot.org> fix some warnings on VC++, patch by John Thompson!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68391 91177308-0d34-0410-b5e6-96231b3b80d8
03d9f34a96ea28eaa698cc779462a1ce1dc79105 01-Apr-2009 Chris Lattner <sabre@nondot.org> remove ASTContext::buildObjCInterfaceType, which breaks canonical
types. It is no longer needed now that the code generator
re-lays-out interfaces if they are defines after being laid out
from a forward decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68194 91177308-0d34-0410-b5e6-96231b3b80d8
1734317845d60307d474b5da8a8d33adbaf5e723 01-Apr-2009 Douglas Gregor <dgregor@apple.com> Parsing, semantic analysis, and template instantiation for typename
specifiers that terminate in a simple-template-id, e.g.,

typename MetaFun::template apply<T1, T2>

Also, implement template instantiation for dependent
nested-name-specifiers that involve unresolved identifiers, e.g.,

typename T::type::type

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68166 91177308-0d34-0410-b5e6-96231b3b80d8
2349925b505564915f786583238266840801b689 31-Mar-2009 Chris Lattner <sabre@nondot.org> Fix a problem in ASTContext::addRecordToClass handling forward declarations.
In a case like:

@class foo;
foo *P;

addRecordToClass was making an empty shadow struct for the foo interface and
completing it. Later when an:

@interface foo

foo *Q;

was seen, ASTContext::addRecordToClass would think that foo was already laid
out and not lay out the definition. This fixes it to create a forward declared
struct the first time around, then complete it when the definition is seen.

Note that this causes two tests to regress, because something is trying to get
the size of the forward declared structs returned by this. Previously, this
would end up getting a size of zero but now it properly dies. I'm not sure
what the right solution is for this, so I xfailed the tests.

Fariborz, please take a look at this. The testcase in rdar://6676794 now gets
farther, but dies later because the objc ivar is not assigned a field number.

As an aside, I really don't like the fact that the objc front-end is creating
shadow C structs for ObjC types. This seems like an implementation detail of
the code generator that could be fixed by better factoring of the extant code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68106 91177308-0d34-0410-b5e6-96231b3b80d8
f1690858344968358131f8d5690d9ee458883000 31-Mar-2009 Chris Lattner <sabre@nondot.org> fill in temporary smallvectors instead of vectors for performance.
Fix BuildAggrIvarLayout to not access vectors out of range.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68101 91177308-0d34-0410-b5e6-96231b3b80d8
7532dc66648cfe7432c9fe66dec5225f0ab301c6 31-Mar-2009 Douglas Gregor <dgregor@apple.com> Improve the representation of template names in the AST. This
representation handles the various ways in which one can name a
template, including unqualified references ("vector"), qualified
references ("std::vector"), and dependent template names
("MetaFun::template apply").

One immediate effect of this change is that the representation of
nested-name-specifiers in type names for class template
specializations (e.g., std::vector<int>) is more accurate. Rather than
representing std::vector<int> as


we represent it as


which more closely follows the C++ grammar.

Additionally, templates are no longer represented as declarations
(DeclPtrTy) in Parse-Sema interactions. Instead, I've introduced a new
OpaquePtr type (TemplateTy) that holds the representation of a
TemplateName. This will simplify the handling of dependent
template-names, once we get there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68074 91177308-0d34-0410-b5e6-96231b3b80d8
557c5b1717bc8919b1b40cf2064b51491ec53a44 28-Mar-2009 Chris Lattner <sabre@nondot.org> push more ASTContext goodness out through interfaces that use

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67913 91177308-0d34-0410-b5e6-96231b3b80d8
a9376d470ccb0eac74fe09a6b2a18a890f1d17c4 28-Mar-2009 Chris Lattner <sabre@nondot.org> move serialization logic from TranslationUnit to ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67902 91177308-0d34-0410-b5e6-96231b3b80d8
d57959af02b4af695276f4204443afe6e5d86bd8 28-Mar-2009 Douglas Gregor <dgregor@apple.com> Initial implementation of parsing, semantic analysis, and template
instantiation for C++ typename-specifiers such as

typename T::type

The parsing of typename-specifiers is relatively easy thanks to
annotation tokens. When we see the "typename", we parse the
typename-specifier and produce a typename annotation token. There are
only a few places where we need to handle this. We currently parse the
typename-specifier form that terminates in an identifier, but not the
simple-template-id form, e.g.,

typename T::template apply<U, V>

Parsing of nested-name-specifiers has a similar problem, since at this
point we don't have any representation of a class template
specialization whose template-name is unknown.

Semantic analysis is only partially complete, with some support for
template instantiation that works for simple examples.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67875 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
ad75653f81dece1c806e9c28dd7e7582c9929a27 26-Mar-2009 Ted Kremenek <kremenek@apple.com> Because of the use of 'cast<TagDecl>', ASTContext.h now depends on Decl.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67773 91177308-0d34-0410-b5e6-96231b3b80d8
befc20e1dc869edb0e7b560e69f32d5c71f867ab 26-Mar-2009 Douglas Gregor <dgregor@apple.com> The injected-class-name of class templates and class template
specializations can be treated as a template. Finally, we can parse
and process the first implementation of Fibonacci I wrote!

Note that this code does not handle all of the cases where
injected-class-names can be treated as templates. In particular,
there's an ambiguity case that we should be able to handle (but
can't), e.g.,

template <class T> struct Base { };
template <class T> struct Derived : Base<int>, Base<char> {
typename Derived::Base b; // error: ambiguous
typename Derived::Base<double> d; // OK

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67720 91177308-0d34-0410-b5e6-96231b3b80d8
e4e5b054b4917f0ee493bb2fda5b1ec749bfb9a1 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Introduce a representation for types that we referred to via a
qualified name, e.g.,


so that we retain the nested-name-specifier as written in the source
code and can reproduce that qualified name when printing the types
back (e.g., in diagnostics). This is PR3493, which won't be complete
until finished the other tasks mentioned near the end of this commit.

The parser's representation of nested-name-specifiers, CXXScopeSpec,
is now a bit fatter, because it needs to contain the scopes that
precede each '::' and keep track of whether the global scoping
operator '::' was at the beginning. For example, we need to keep track
of the leading '::', 'foo', and 'bar' in


The Action's CXXScopeTy * is no longer a DeclContext *. It's now the
opaque version of the new NestedNameSpecifier, which contains a single
component of a nested-name-specifier (either a DeclContext * or a Type
*, bitmangled).

The new sugar type QualifiedNameType composes a sequence of
NestedNameSpecifiers with a representation of the type we're actually
referring to. At present, we only build QualifiedNameType nodes within
Sema::getTypeName. This will be extended to other type-constructing
actions (e.g., ActOnClassTemplateId).

Also on the way: QualifiedDeclRefExprs will also store a sequence of
NestedNameSpecifiers, so that we can print out the property
nested-name-specifier. I expect to also use this for handling
dependent names like Fibonacci<I - 1>::value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67265 91177308-0d34-0410-b5e6-96231b3b80d8
7c80bd64032e610c0dbd74fc0ef6ea334447f2fd 17-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Almost complete implementation of rvalue references. One bug, and a few unclear areas. Maybe Doug can shed some light on some of the fixmes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67059 91177308-0d34-0410-b5e6-96231b3b80d8
40808ce6ac04b102c3b56244a635d6b98eed6d97 10-Mar-2009 Douglas Gregor <dgregor@apple.com> Implement template instantiation for ClassTemplateSpecializationTypes,
such as replacing 'T' in vector<T>. There are a few aspects to this:

- Extend TemplateArgument to allow arbitrary expressions (an
Expr*), and switch ClassTemplateSpecializationType to store
TemplateArguments rather than it's own type-or-expression

- ClassTemplateSpecializationType can now store dependent types. In
that case, the canonical type is another
ClassTemplateSpecializationType (with default template arguments
expanded) rather than a declaration (we don't build Decls for
dependent types).

- Split ActOnClassTemplateId into ActOnClassTemplateId (called from
the parser) and CheckClassTemplateId (called from
ActOnClassTemplateId and InstantiateType). They're smart enough to
handle dependent types, now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66509 91177308-0d34-0410-b5e6-96231b3b80d8
88e469cf4240d4b898eacc0ad092019b022e0e50 05-Mar-2009 Fariborz Jahanian <fjahanian@apple.com> Moved CollectObjCIvars to more commonly available place
for future use.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66184 91177308-0d34-0410-b5e6-96231b3b80d8
72564e73277e29f6db3305d1f27ba408abb7ed88 27-Feb-2009 Douglas Gregor <dgregor@apple.com> Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types.

Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.

As part of this, some types have been renamed:

TypeOfExpr -> TypeOfExprType
FunctionTypeProto -> FunctionProtoType
FunctionTypeNoProto -> FunctionNoProtoType

There shouldn't be any functionality change...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8
3a2503227c3db04a3619735127483263c1075ef7 27-Feb-2009 Chris Lattner <sabre@nondot.org> make ASTContext::WCharTy a bit more sensical. In C++, it is a disctint type,
but in C99 it is just another int type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65590 91177308-0d34-0410-b5e6-96231b3b80d8
d461777e23204fe8c480302d8ff76f5847605da6 23-Feb-2009 Steve Naroff <snaroff@apple.com> Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.

Remove support for "Class<P>". Will be making this an error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65332 91177308-0d34-0410-b5e6-96231b3b80d8
15509f4fe73f0e11a8cec602bce4d99d9454b7f6 21-Feb-2009 Steve Naroff <snaroff@apple.com> Add support for GCC ObjC extension "Class<protocol>". Sigh.

Found while researching <rdar://problem/6497631> Message lookup is sometimes different than gcc's.

Will never be seen in user code. Needed to pass dejagnu testsuite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65244 91177308-0d34-0410-b5e6-96231b3b80d8
92dd386e3f05d176b45a638199d51f536bd9d1c4 20-Feb-2009 Chris Lattner <sabre@nondot.org> replace a dirty hack with a clean solution. Too bad we can't
use Blocks for our callbacks ;-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65083 91177308-0d34-0410-b5e6-96231b3b80d8
4fd83ea566f4a0c083001c84b75da6cc8c99c1d6 18-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Some refactoring and simplificaiotn of objc's gc
ir gen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64954 91177308-0d34-0410-b5e6-96231b3b80d8
d33d9c0cc0cfdcd0b10f35a6acdfb25da4a64f19 18-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Representation of objc gc's attribute using ExtQualType.
Note that one test attr-objc-gc.m fails. I will fix this
after removing these attributes from the Decl nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64889 91177308-0d34-0410-b5e6-96231b3b80d8
0cd7fc28d4f69b281522b1bc96decd2b92cfd812 18-Feb-2009 Daniel Dunbar <daniel@zuster.org> Add ASTContext::MakeIntValue
- Makes an APSInt given a uint64_t and a type, with the appropriate
width and signedness to match the type. Yay for functional over

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64863 91177308-0d34-0410-b5e6-96231b3b80d8
b7d0844c887a72064b624dc6df12cbe1441f69d0 17-Feb-2009 Daniel Dunbar <daniel@zuster.org> Eek! getDeclAlign sometimes returned alignment in bits.
- Renamed to getDeclAlignInBytes since most other query functions
work in bits.

- Fun to track down as isIntegerConstantExpr was getting it right,
but Evaluate() was getting it wrong. Maybe we should assert they
compute the same thing when they succeed?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64828 91177308-0d34-0410-b5e6-96231b3b80d8
f11284ac87daa613bc7b30db9f54bd716d123222 17-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Renamed ASQualType to ExtQualType to reflect its more
general use; as for, objc2's gc type attributes. No
change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64778 91177308-0d34-0410-b5e6-96231b3b80d8
f3710babc1ba40779c0fc64e6657cfc84dee7545 14-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Fixed a problem caused by foreward @class use
which consequently caused a Seg fault. during meta-data
generation. It also addresses an issue related to
late binding of newly synthesize ivars (when we support it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64563 91177308-0d34-0410-b5e6-96231b3b80d8
f98aba35e6c3da5aae61843fc01334939e4e12ec 13-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Initial implementation of arbitrary fixed-width integer types.
Currently only used for 128-bit integers.

Note that we can't use the fixed-width integer types for other integer
modes without other changes because glibc headers redefines (u)int*_t
and friends using the mode attribute. For example, this means that uint64_t
has to be compatible with unsigned __attribute((mode(DI))), and
uint64_t is currently defined to long long. And I have a feeling we'll
run into issues if we try to define uint64_t as something which isn't
either long or long long.

This doesn't get the alignment right in most cases, including
the 128-bit integer case; I'll file a PR shortly. The gist of the issue
is that the targets don't really expose the information necessary to
figure out the alignment outside of the target description, so there's a
non-trivial amount of work involved in getting it working right. That
said, the alignment used is conservative, so the only issue with the
current implementation is ABI compatibility.

This makes it trivial to add some sort of "bitwidth" attribute to make
arbitrary-width integers; I'll do that in a followup.

We could also use this for stuff like the following for compatibility
with gcc, but I have a feeling it would be a better idea for clang to be
consistent between C and C++ modes rather than follow gcc's example for
C mode.
struct {unsigned long long x : 33;} x;
unsigned long long a(void) {return x.x+1;}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64434 91177308-0d34-0410-b5e6-96231b3b80d8
389bf46ae41241a656ed71b00ac2177d7f385651 12-Feb-2009 Steve Naroff <snaroff@apple.com> Several cleanups:
- rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect.
- add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time.
- move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64385 91177308-0d34-0410-b5e6-96231b3b80d8
8e6563ba097732dc1fffcfc85f8dbbceac899a80 11-Feb-2009 Douglas Gregor <dgregor@apple.com> Reverted r64307. Moved hasSameType and hasSameUnqualifiedType from
Sema to ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64312 91177308-0d34-0410-b5e6-96231b3b80d8
55f6b14230c94272efbbcdd89a92224c8db9f225 09-Feb-2009 Douglas Gregor <dgregor@apple.com> Start processing template-ids as types when the template-name refers
to a class template. For example, the template-id 'vector<int>' now
has a nice, sugary type in the type system. What we can do now:

- Parse template-ids like 'vector<int>' (where 'vector' names a
class template) and form proper types for them in the type system.
- Parse icky template-ids like 'A<5>' and 'A<(5 > 0)>' properly,
using (sadly) a bool in the parser to tell it whether '>' should
be treated as an operator or not.

This is a baby-step, with major problems and limitations:
- There are currently two ways that we handle template arguments
(whether they are types or expressions). These will be merged, and,
most likely, TemplateArg will disappear.
- We don't have any notion of the declaration of class template
specializations or of template instantiations, so all template-ids
are fancy names for 'int' :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64153 91177308-0d34-0410-b5e6-96231b3b80d8
4398a78095cd05a3be702fbab25bfe324a5d7946 06-Feb-2009 Ted Kremenek <kremenek@apple.com> Update comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63961 91177308-0d34-0410-b5e6-96231b3b80d8
42542c6a4b3c60f63820e6177a8938443831492c 06-Feb-2009 Ted Kremenek <kremenek@apple.com> Added special versions of new[]/delete[] to complement the new/delete which uses ASTContext's allocator. Updated some comments along the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63949 91177308-0d34-0410-b5e6-96231b3b80d8
fab9d67cebb87be968e7ae31a3b549a5279b5d51 06-Feb-2009 Douglas Gregor <dgregor@apple.com> Improve the representation of template type parameters. We now
canonicalize by template parameter depth, index, and name, and the
unnamed version of a template parameter serves as the canonical.

TemplateTypeParmDecl no longer needs to inherit from
TemplateParmPosition, since depth and index information is present
within the type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63899 91177308-0d34-0410-b5e6-96231b3b80d8
2a3009a432bdcec59e6383d7b2b17494d6f91649 03-Feb-2009 Douglas Gregor <dgregor@apple.com> Semantic analysis, ASTs, and unqualified name lookup support for C++
using directives, from Piotr Rak!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63646 91177308-0d34-0410-b5e6-96231b3b80d8
c0ac4923f08b25ae973a8ee7942cf3eb89da57b7 28-Jan-2009 Steve Naroff <snaroff@apple.com> Finish making AST BumpPtrAllocation runtime configurable (based on -disable-free).

snaroff% time ../../Release-Asserts/bin/clang INPUTS/Cocoa_h.m
0.179u 0.051s 0:00.23 95.6% 0+0k 0+0io 0pf+0w
snaroff% time ../../Release-Asserts/bin/clang INPUTS/Cocoa_h.m -disable-free
0.169u 0.052s 0:00.22 95.4% 0+0k 0+0io 0pf+0w

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63153 91177308-0d34-0410-b5e6-96231b3b80d8
3e9704981d7691fdd44913bf1786e8d760d8a627 27-Jan-2009 Steve Naroff <snaroff@apple.com> Remove many references to ASTContext::getAllocator(), replacing them with calls to the recently added placement new (which uses ASTContext's allocator for memory). Also added ASTContext::Deallocate().

This will simplify runtime replacement of ASTContext's allocator. Keeping the allocator private (and removing getAllocator() entirely) is also goodness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63135 91177308-0d34-0410-b5e6-96231b3b80d8
34ebde404dc17d89487b07e6daaf1b47d5dfee39 27-Jan-2009 Chris Lattner <sabre@nondot.org> add a new "getPreferredTypeAlign" method to return the preferred alignment
of a type. The implementation is currently something of a hack, but is
sufficient for now and allows clients to be built on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63108 91177308-0d34-0410-b5e6-96231b3b80d8
f65dd5681b34f195a29ddd6ee134b7743ed78cdd 26-Jan-2009 Chris Lattner <sabre@nondot.org> improve ASTContext::getDeclAlign comment, as suggested by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62975 91177308-0d34-0410-b5e6-96231b3b80d8
af707ab8fbb9451e8febb8d766f6c043628125c4 24-Jan-2009 Chris Lattner <sabre@nondot.org> add initial support for the gcc "alignof(decl) is the alignment of the decl
not the type" semantics. This can definitely be improved, but is better than
what we had.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62939 91177308-0d34-0410-b5e6-96231b3b80d8
f30208ad5b334e93582e846a2a0c92f38a607b8a 24-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add support for declaring pointers to members.
Add serialization support for ReferenceType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62934 91177308-0d34-0410-b5e6-96231b3b80d8
7106a3aea3cdbf409aed3e32235d909a47e25501 21-Jan-2009 Steve Naroff <snaroff@apple.com> Removed alignment argument to delete operator. It isn't needed and Visual Studio is offended by it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62707 91177308-0d34-0410-b5e6-96231b3b80d8
e91b3bc1624ec877862e5d276f1b6f5026fe71e3 20-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Provide a placement new taking an ASTContext argument.
This allows more concise syntax when allocating an object using the ASTContext's allocator.
Convert a few allocations to this operator to for test purposes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62623 91177308-0d34-0410-b5e6-96231b3b80d8
090b3f71702c5626d8520f9608d77c6f26dcfa15 20-Jan-2009 Fariborz Jahanian <fjahanian@apple.com> Improving on encoding of objective-c's property types. More to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62601 91177308-0d34-0410-b5e6-96231b3b80d8
0b7a158d120ac8d78c114a823e17eedfec6b6658 17-Jan-2009 Douglas Gregor <dgregor@apple.com> Teach DeclContext how to find the primary declaration for any TagDecl
even when we are still defining the TagDecl. This is required so that
qualified name lookup of a class name within its definition works (see
the new bits in test/SemaCXX/qualified-id-lookup.cpp).

As part of this, move the nested redefinition checking code into
ActOnTag. This gives us diagnostics earlier (when we try to perform
the nested redefinition, rather than when we try to complete the 2nd
definition) and removes some code duplication.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62386 91177308-0d34-0410-b5e6-96231b3b80d8
be63802d1efe52697f49aafea49a5028b30b0aff 14-Jan-2009 Steve Naroff <snaroff@apple.com> Add a FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62214 91177308-0d34-0410-b5e6-96231b3b80d8
fa23c1d9adc99c662c1c0e192817185809d95614 14-Jan-2009 Fariborz Jahanian <fjahanian@apple.com> Implemenent objective-c's NSObject attribute as a way of ddeclaraing c-type
objects as an objective-c object.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62197 91177308-0d34-0410-b5e6-96231b3b80d8
a1c033e9514865f3a7b0d8b3b20e6de926cfec6c 23-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> Lot more encoding work. We are closing the gap to
gcc compatibilty in all aspects of encoding now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61383 91177308-0d34-0410-b5e6-96231b3b80d8
5b8c7d9fb620ba3a71e996d61e7b9bdf763b5c09 23-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> More encoding support; in this case, encoding of
outer-most const of pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61355 91177308-0d34-0410-b5e6-96231b3b80d8
6183a99b064b397d98297904fbd6cf00fe1f453d 21-Dec-2008 Anders Carlsson <andersca@mac.com> Add ASTContext::getBaseElementType and use it in CodeGenFunction::EmitArraySubscriptExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61303 91177308-0d34-0410-b5e6-96231b3b80d8
43822eaeddeaa419b90f23c68af6b23c46788a58 20-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> More encoding support. This time for
@encode of classes and bitfields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61268 91177308-0d34-0410-b5e6-96231b3b80d8
efc4c4bdbd8fee90b93deb3b5cfaeb044ae22557 18-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> Removed a slot in ObjCMemRegExpr used in
code gen which did not belong there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61203 91177308-0d34-0410-b5e6-96231b3b80d8
a769c004a2874504c17ea8afccbc4ad35fc33c9f 17-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> This patch will build the Records lazily per Steve's comments.
Note that one test duplicate-ivar-check.m will fail because I
need to re-implement duplicate ivar checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61154 91177308-0d34-0410-b5e6-96231b3b80d8
fea8685bf3036b199c573e70b03affde2583fc44 16-Dec-2008 Nate Begeman <natebegeman@mac.com> Remove tabs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61097 91177308-0d34-0410-b5e6-96231b3b80d8
44b4321feab46299d3f5cfd404680884752a0fcf 11-Dec-2008 Douglas Gregor <dgregor@apple.com> Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
* Make DeclContext the central data structure for storing and
looking up declarations within existing declarations, e.g., members
of structs/unions/classes, enumerators in C++0x enums, members of
C++ namespaces, and (later) members of Objective-C
interfaces/implementations. DeclContext uses a lazily-constructed
data structure optimized for fast lookup (array for small contexts,
hash table for larger contexts).

* Implement C++ qualified name lookup in terms of lookup into

* Implement C++ unqualified name lookup in terms of
qualified+unqualified name lookup (since unqualified lookup is not
purely lexical in C++!)

* Limit the use of the chains of declarations stored in
IdentifierInfo to those names declared lexically.

* Eliminate CXXFieldDecl, collapsing its behavior into
FieldDecl. (FieldDecl is now a ScopedDecl).

* Make RecordDecl into a DeclContext and eliminates its
Members/NumMembers fields (since one can just iterate through the
DeclContext to get the fields).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60878 91177308-0d34-0410-b5e6-96231b3b80d8
898574e7496ba8fd76290079d3a9d06954992734 06-Dec-2008 Douglas Gregor <dgregor@apple.com> Introduce basic support for dependent types, type-dependent
expressions, and value-dependent expressions. This permits us to parse
some template definitions.

This is not a complete solution; we're missing type- and
value-dependent computations for most of the expression types, and
we're missing checks for dependent types and type-dependent
expressions throughout Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60615 91177308-0d34-0410-b5e6-96231b3b80d8
72c3f314d92d65c050ee1c07b7753623c044d6c7 05-Dec-2008 Douglas Gregor <dgregor@apple.com> Representation of template type parameters and non-type template
parameters, with some semantic analysis:
- Template parameters are introduced into template parameter scope
- Complain about template parameter shadowing (except in Microsoft mode)

Note that we leak template parameter declarations like crazy, a
problem we'll remedy once we actually create proper declarations for

Next up: dependent types and value-dependent/type-dependent

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60597 91177308-0d34-0410-b5e6-96231b3b80d8
2e1cd4264d363ca869bf37ef160902f211d21b8c 17-Nov-2008 Douglas Gregor <dgregor@apple.com> Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of
languages. DeclarationName is used in NamedDecl to store the name of
the declaration (naturally), and ObjCMethodDecl is now a NamedDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59441 91177308-0d34-0410-b5e6-96231b3b80d8
1d75118af76cae2bfc06389cde410e14bd0a19fc 08-Nov-2008 Daniel Dunbar <daniel@zuster.org> Support getTypeInfo, getTypeAlign, getTypeSize on const Type*s.
- Size/align are not effected by CVR qualifiers.

Support getCanonicalType: const Type* -> const Type*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58891 91177308-0d34-0410-b5e6-96231b3b80d8
d934112e6170b0fd940d8e40db6936cea2cdcf62 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Eliminate header dependency ASTContext -> TargetInfo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58613 91177308-0d34-0410-b5e6-96231b3b80d8
b4e66d5259f90e9aae4d40fc5de801e046c7df94 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Connect ASTContext to TargetInfo when determining the size_t, ptrdiff_t, and wchar_t types. Fixes recent breakage on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58609 91177308-0d34-0410-b5e6-96231b3b80d8
7fb5e4888221cd36652d078c6b171ac55e7f406d 26-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58187 91177308-0d34-0410-b5e6-96231b3b80d8
971c4fae6092976338b755af1d47dac07c8f16e3 24-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> -Add support for cv-qualifiers after function declarators.
-Add withConst/withVolatile/withRestrict methods to QualType class, that return the QualType plus the respective qualifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58120 91177308-0d34-0410-b5e6-96231b3b80d8
e22d911dcff7a9c18b583817b7319c07600fd3ee 24-Oct-2008 Ted Kremenek <kremenek@apple.com> Added iterators for types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58050 91177308-0d34-0410-b5e6-96231b3b80d8
8e9bebdea69c590dedfbf27374114cb76fe12fbd 21-Oct-2008 Douglas Gregor <dgregor@apple.com> Preliminary support for function overloading

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
0d504c1da852e58ff802545c823ecff3b6c654b8 17-Oct-2008 Daniel Dunbar <daniel@zuster.org> Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57716 91177308-0d34-0410-b5e6-96231b3b80d8
d96b35bc6becf8db00d140c11e3d0e53f27567a1 17-Oct-2008 Daniel Dunbar <daniel@zuster.org> More Obj-C type encoding improvements.
- Encode unions and bit-fields correctly.
- Accept option to name record fields (used for NeXT runtime).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57685 91177308-0d34-0410-b5e6-96231b3b80d8
82a6cfbc421cc99c5b7313271f399f7ef95056ec 17-Oct-2008 Daniel Dunbar <daniel@zuster.org> Fix bug in Obj-C type encoding for structures.
- Mechanism for detecting if a structure should be expanded wasn't
reliable. Simplified by just keeping track of what we should be

- This fixes a bug in using NSInvocation to invoke a method which
returned a structure, which in used by Key Value Observing, which
in the end, caused a miscompile in poor little Sketch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57675 91177308-0d34-0410-b5e6-96231b3b80d8
4b7c98378ae0c1a3635f0b7756848b4a9923f8bc 05-Sep-2008 Ted Kremenek <kremenek@apple.com> Change struct forward declarations and definitions to use unique RecordDecls, as opposed to creating a single RecordDecl and reusing it.

This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).

The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.

- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
addition of DeclGroups.

Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
referenced by the AST. For example:

typedef struct { ... } x;

The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
refer to it. This will be solved with DeclGroups.

- This patch also (temporarily) breaks CodeGen. More below.

High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it. When
a struct/union/class is first referenced, a RecordType and RecordDecl are
created for it, and the RecordType refers to that RecordDecl. Later, if
a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
updated to point to the RecordDecl that defines the struct/union/class.

- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
enum/struct/class/union. This is useful from going from a RecordDecl* that
defines a forward declaration to the RecordDecl* that provides the actual
definition. Note that this also works for EnumDecls, except that in this case
there is no distinction between forward declarations and definitions (yet).

- Clients should no longer assume that 'isDefinition()' returns true from a
RecordDecl if the corresponding struct/union/class has been defined.
isDefinition() only returns true if a particular RecordDecl is the defining
Decl. Use 'getDefinition()' instead to determine if a struct has been defined.

- The main changes to Sema happen in ActOnTag. To make the changes more
incremental, I split off the processing of enums and structs et al into two
code paths. Enums use the original code path (which is in ActOnTag) and
structs use the ActOnTagStruct. Eventually the two code paths will be merged,
but the idea was to preserve the original logic both for comparison and not to
change the logic for both enums and structs all at once.

- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
that correspond to the same type simply have a pointer to that type. If we
need to figure out what are all the RecordDecls for a given type we can build
a backmap.

- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
changes to RecordDecl. For some reason 'svn' marks the entire file as changed.

Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
RecordType*. This was true before because we only created one RecordDecl* for
a given RecordType*, but it is no longer true. I believe this shouldn't be too
hard to change, but the patch was big enough as it is.

I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55839 91177308-0d34-0410-b5e6-96231b3b80d8
1c7d067550c2d9bca8997d0e67ee6b280d493202 04-Sep-2008 Steve Naroff <snaroff@apple.com> Add type checking for blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55767 91177308-0d34-0410-b5e6-96231b3b80d8
bd4c1ada2e8668f43a865dc2c662085cf61940c4 30-Aug-2008 Anders Carlsson <andersca@mac.com> Add code to create the fast enumeration state type

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55572 91177308-0d34-0410-b5e6-96231b3b80d8
77a49f6b1e5741f6bda71eb7837b43343925027b 28-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix compilation error on MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55465 91177308-0d34-0410-b5e6-96231b3b80d8
c56f34a1c1779de15330bdb3eec39b3418802d47 28-Aug-2008 Daniel Dunbar <daniel@zuster.org> NeXT: Emit mostly-correct property type encoding.
- Added ASTContext::getObjCEncodingForPropertyDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55461 91177308-0d34-0410-b5e6-96231b3b80d8
5618bd4a52c45fbbb605e3ba885663b2164db8a3 27-Aug-2008 Steve Naroff <snaroff@apple.com> First wave of changes to support "blocks" (an extension to C).
This commit adds the declaration syntax (and associated type).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55417 91177308-0d34-0410-b5e6-96231b3b80d8
86da77fdaf4c0237eafb9670f54eee20b08635bf 22-Aug-2008 Eli Friedman <eli.friedman@gmail.com> Minor const cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55160 91177308-0d34-0410-b5e6-96231b3b80d8
3d815e7eb56c25d7ed812eced32e41df43039f9a 22-Aug-2008 Eli Friedman <eli.friedman@gmail.com> Rewrite type compatibility testing to do type merging rather than just
testing compatibility. This is necessary for some constructs, like merging

Also, there are some ObjC changes to make sure that
typesAreCompatible(a,b) == typesAreCompatible(b,a). I don't have any
ObjC code beyond the testsuite, so please tell me if there are any cases
where this doesn't behave as expected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55158 91177308-0d34-0410-b5e6-96231b3b80d8
e91593ef084479340582b2ba177b44be50a717b7 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and
- Move ASTContext constructor into implementation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54627 91177308-0d34-0410-b5e6-96231b3b80d8
55f4b02bc71e7347986c6a5249bef635aac1901a 09-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Change 'Wchar' to 'WChar' casing, for consistency.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54588 91177308-0d34-0410-b5e6-96231b3b80d8
64c438a4be2a871fa43c78264663ba1e9788b94d 09-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement support for the 'wchar_t' C++ type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54585 91177308-0d34-0410-b5e6-96231b3b80d8
c63a1f276f7b324fd9a4be82098b1c8f7bf30733 04-Aug-2008 Chris Lattner <sabre@nondot.org> Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).

Fixing this greatly simplifies getArrayDecayedType, which is a good sign.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54317 91177308-0d34-0410-b5e6-96231b3b80d8
62f5f7ffad57e0c2af2b308af3735351505937cb 26-Jul-2008 Chris Lattner <sabre@nondot.org> fix several problems with the protocol qualified id handling where id was implicit.

First, fix canonical type handling of these, since protocol qualified id's are always
canonical. Next, enhance SemaType to actually make these when used (instead of int)
allowing them to actually be used when appropriate. Finally remove a bunch of logic
relating to the mishandling of canonical types with protocol-qual id's. This fixes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54083 91177308-0d34-0410-b5e6-96231b3b80d8
b6ccaac65ca72f72954eb3893bbd940bedd23f00 25-Jul-2008 Ted Kremenek <kremenek@apple.com> Move isObjCObjectPointerType() from Sema to ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53998 91177308-0d34-0410-b5e6-96231b3b80d8
d85376aa66bc16488539f6bb11f97d0170b1fe6b 21-Jul-2008 Chris Lattner <sabre@nondot.org> improve comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53818 91177308-0d34-0410-b5e6-96231b3b80d8
b7cfe88e88cb4f46308de89cf3f0c81bfe624128 30-Jun-2008 Chris Lattner <sabre@nondot.org> Make a few related changes:

1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their
fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52914 91177308-0d34-0410-b5e6-96231b3b80d8
ad74a758189180b8ab8faea648e4766c3bfd7fcb 28-Jun-2008 Eli Friedman <eli.friedman@gmail.com> Fix for PR2501; this patch makes usual arithmetic conversions for
integers which have the same width and different signedness work
correctly. (The testcase in PR2501 uses a comparison between long and
unsigned int).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52853 91177308-0d34-0410-b5e6-96231b3b80d8
44a3dded8080c5c9cfdad208ade8f8f7850d9a4f 04-Jun-2008 Devang Patel <dpatel@apple.com> Add ObjCInterface layout support.
Reuse RecordLayout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51968 91177308-0d34-0410-b5e6-96231b3b80d8
e7d07d113677a39026ff5119b8b67f6fe8ca9793 04-Jun-2008 Ted Kremenek <kremenek@apple.com> Moved LangOptions from TranslationUnit to ASTContext. This induced a variety of cleanups in some ASTConsumers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51943 91177308-0d34-0410-b5e6-96231b3b80d8
213541a68a3e137d11d2cefb612c6cdb410d7e8e 19-Apr-2008 Nate Begeman <natebegeman@mac.com> OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
ef177820100ab583b08fd3056e2a5a52ee4b1629 17-Apr-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Addition of TranslationUnitDecl to the AST:

-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49855 91177308-0d34-0410-b5e6-96231b3b80d8
2ce52f3fb95bf544db6bd3d91a72bce7d9cceb6c 13-Apr-2008 Douglas Gregor <dgregor@apple.com> Introduce support for finding class and enum names via ordinary name lookup in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49621 91177308-0d34-0410-b5e6-96231b3b80d8
acc9972da24df89ea283d6f979ffbd0e4fa0e1a5 07-Apr-2008 Chris Lattner <sabre@nondot.org> simplify array compatibility testing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49326 91177308-0d34-0410-b5e6-96231b3b80d8
78eca286b0898e98bb2cee943b4ecbea9cc07dd6 07-Apr-2008 Chris Lattner <sabre@nondot.org> simplify compatibility testing for tag types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49323 91177308-0d34-0410-b5e6-96231b3b80d8
3cc4c0c3058a788689b8fc73c0ac139544435c97 07-Apr-2008 Chris Lattner <sabre@nondot.org> Remove a dead check for compatible builtin types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49319 91177308-0d34-0410-b5e6-96231b3b80d8
6e26f5db807a75713dbf6e34cf93da6fffe18cc3 07-Apr-2008 Chris Lattner <sabre@nondot.org> futher simplify compatibility testing of objc interface types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49318 91177308-0d34-0410-b5e6-96231b3b80d8
f62f9cd5a78e5445a02e37b277f7a2df9c19b7a3 07-Apr-2008 Chris Lattner <sabre@nondot.org> simplify vector type compatibility testing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49314 91177308-0d34-0410-b5e6-96231b3b80d8
eca7be6b7ebd93682eeaab2c71d59f2995dacdcc 07-Apr-2008 Chris Lattner <sabre@nondot.org> move ObjCQualifiedIdTypesAreCompatible out of ASTContext into Sema.
While it is similar to the other compatibility predicates in ASTContext,
it is not used by them and is different.

In addition, greatly simplify ObjCQualifiedIdTypesAreCompatible and
fix some canonical type bugs. Also, simplify my Type::getAsObjC* methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49313 91177308-0d34-0410-b5e6-96231b3b80d8
3b27546b42bc3d5ec261f3228192350affb370be 07-Apr-2008 Chris Lattner <sabre@nondot.org> make QualifiedInterfaceTypesAreCompatible a static function
and start simplifying it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49307 91177308-0d34-0410-b5e6-96231b3b80d8
c4e405996217f4be20f73186da53b23b5c4783dc 07-Apr-2008 Chris Lattner <sabre@nondot.org> Simplify some objc compatibility testing, make interfaceTypesAreCompatible
a static function named isCompatibleInterfaceAssign.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49305 91177308-0d34-0410-b5e6-96231b3b80d8
368eefa081d12f0a265ee90ee8ec61b54168d57d 07-Apr-2008 Chris Lattner <sabre@nondot.org> clean up some logic in objc type handling. Specifically, make it so that
there are QualType::getAsObjc* type methods, and make isa<ObjCInterfaceType>
return true for ObjCQualifiedInterfaceType's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49300 91177308-0d34-0410-b5e6-96231b3b80d8
7cfeb08f2466d6263ec6ff1402298f93f6d6991f 07-Apr-2008 Chris Lattner <sabre@nondot.org> simplify max type computation by making it return an integer (like
getFloatingTypeOrder) instead of a type. Fix a fixme.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49297 91177308-0d34-0410-b5e6-96231b3b80d8
a75cea3f6be0daa8054d36af81a6ffda1713f82d 07-Apr-2008 Chris Lattner <sabre@nondot.org> minor simplifications/cleanups to type comparisons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49296 91177308-0d34-0410-b5e6-96231b3b80d8
f52ab250ff92bc51a9ac9a8e19bd43b63a5f844f 07-Apr-2008 Chris Lattner <sabre@nondot.org> Start switching clients over from CT.getCanonicalType() to Context.getCanonicalType(CT) for PR2189.

While I'm at it, clean up a bit of maxIntegerType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49292 91177308-0d34-0410-b5e6-96231b3b80d8
77c9647cae939104c6cb2b6a4dd8ca859d2e5770 07-Apr-2008 Chris Lattner <sabre@nondot.org> introduce a new ASTContext::getCanonicalType method. This is the first
step towards fixing PR2189.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49291 91177308-0d34-0410-b5e6-96231b3b80d8
e6327747b72bb687c948270f702ff53c30f411a6 02-Apr-2008 Chris Lattner <sabre@nondot.org> Fix several bugs in array -> pointer decomposition.

First, we got several CVR propagation cases wrong, which Eli pointed
out in PR2039.

Second, we didn't propagate address space qualifiers correctly, leading
to incorrect lowering of code in CodeGen/address-space.c.

Third, we didn't uniformly propagate the specifier in the array to the
pointer ("int[restrict 4]" -> "int *restrict").

This adds an ASTContext::getArrayDecayedType member that handles the
non-trivial logic for this seemingly simple operation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49078 91177308-0d34-0410-b5e6-96231b3b80d8
6c2b6eb8d836da19007f7540709e16d5e39a1cba 15-Mar-2008 Chris Lattner <sabre@nondot.org> start switching decls over to using an allocator controlled by ASTContext.
Right now only some ctors are switched over. I need to switch them all
over so I can change the dtor over.

This lets us experiment with region allocation and other things in the

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48390 91177308-0d34-0410-b5e6-96231b3b80d8
98be4943e8dc4f3905629a7102668960873cf863 05-Mar-2008 Chris Lattner <sabre@nondot.org> remove the source location arguments to various target query methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47954 91177308-0d34-0410-b5e6-96231b3b80d8
c81c8144a661a49d7b9dae8d2080dee2e43186ec 25-Feb-2008 Chris Lattner <sabre@nondot.org> convert tabs to spaces, patch by Mike Stump!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47560 91177308-0d34-0410-b5e6-96231b3b80d8
f46699ce225811d8d9dbab9d00189a0e54469457 20-Feb-2008 Chris Lattner <sabre@nondot.org> Alternate address spaces work:

rename QualType::getQualifiers to getCVRQualifiers.
Add some fixme's and clean up some code relevant to qualifiers.
Change ASQualType to contain a Type* instead of a QualType.
Any CVR qualifiers should be on the outer qual type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47398 91177308-0d34-0410-b5e6-96231b3b80d8
c5773c4b8ce1ed6ed5c7112c9020c954a47dce96 15-Feb-2008 Eli Friedman <eli.friedman@gmail.com> Split out incomplete arrays from VariableArrayType into
IncompleteArrayType. This should make code dealing with both incomplete
and variable length arrays much more readable, plus it allows properly
making the distinction between isVariableArrayType() and
isVariablyModifiedType(). The patch is a little big, but it's
strightforward. so I don't think there should be any issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47165 91177308-0d34-0410-b5e6-96231b3b80d8
6083ea3723ec3996ae3bdf8d1b352b0c3b3922c8 12-Feb-2008 Ted Kremenek <kremenek@apple.com> Fixed misspelling in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47016 91177308-0d34-0410-b5e6-96231b3b80d8
fd888a581d6d329f5b447c8ff4d37cf396315993 12-Feb-2008 Eli Friedman <eli.friedman@gmail.com> Add wchar_t type to ASTContext. Will be needed for wide strings, since
they are of type wchar_t[].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47004 91177308-0d34-0410-b5e6-96231b3b80d8
ebb97e98c03f8d7034bd3748a10e35f39a95c289 04-Feb-2008 Christopher Lamb <christopher.lamb@gmail.com> Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46691 91177308-0d34-0410-b5e6-96231b3b80d8
7d6b46d9a9d75dea8ef9f6973dd50633c1f37963 22-Jan-2008 Fariborz Jahanian <fjahanian@apple.com> Problem with ObjC's type-encoding of nested structs causing infinit recursion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46260 91177308-0d34-0410-b5e6-96231b3b80d8
a526c5c67e5a0473c340903ee542ce570119665f 07-Jan-2008 Ted Kremenek <kremenek@apple.com> Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45715 91177308-0d34-0410-b5e6-96231b3b80d8
8cc71e8d00896e758cf56ea86cfc1f62ade16478 07-Jan-2008 Fariborz Jahanian <fjahanian@apple.com> Make interfaceTypesAreCompatible a private method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45713 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
d0c89c4609494e4aae0afb7704c35c0e9523f532 21-Dec-2007 Fariborz Jahanian <fjahanian@apple.com> More objective-c type analysis. This time involving objective types
of conforming protocols (or not).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45276 91177308-0d34-0410-b5e6-96231b3b80d8
411f373abf5692a1bd90d35a139d955fa67ae82d 19-Dec-2007 Fariborz Jahanian <fjahanian@apple.com> This patch concludes implementation of dynamic objective-c type qualified by
protocol list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45203 91177308-0d34-0410-b5e6-96231b3b80d8
d58fabf7ed279be18a5e82617f809c9deff9be67 18-Dec-2007 Fariborz Jahanian <fjahanian@apple.com> Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45174 91177308-0d34-0410-b5e6-96231b3b80d8
c569249ca0ab755ac79d8cbbfcb2bcae19743624 17-Dec-2007 Fariborz Jahanian <fjahanian@apple.com> Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45121 91177308-0d34-0410-b5e6-96231b3b80d8
9c728dc4d8da89c73fcae74c9e72d7a83ffd7b6d 12-Dec-2007 Ted Kremenek <kremenek@apple.com> TargetInfo no longer includes a reference to SourceManager.

Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:


instead we have:


Modified TextDiagnostics (and related classes) to use this short-hand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44957 91177308-0d34-0410-b5e6-96231b3b80d8
4ffc54111fdc0baa45bb287f59774e06dea8caa4 12-Dec-2007 Fariborz Jahanian <fjahanian@apple.com> Implemented type checking for pointer of objects of protocol-qualified types.
Note that incompatible-protocol-qualified-types.m is currently failing. This is
unrelated to this patch and Steve is looking at the general problem of not reporting
incompitible pointer types in return stetement..

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44897 91177308-0d34-0410-b5e6-96231b3b80d8
7a9d49fd2bfac00e905b361ba76d26ab5b6c3b09 11-Dec-2007 Ted Kremenek <kremenek@apple.com> Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
66c5dfc193c4090b67c5effb0e80e287b94de17e 07-Dec-2007 Fariborz Jahanian <fjahanian@apple.com> Patch to implement "Protocol" as a built-in type declared as
"@class Protocol;"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44670 91177308-0d34-0410-b5e6-96231b3b80d8
03ed44061df258e74a40383bda849e14b892a8c6 13-Nov-2007 Ted Kremenek <kremenek@apple.com> Rewrote type serialization to used the same methodology as we do for Decls.
Removed tons of dead code in ASTContext concerning how types use to be
Removed serialization methods from QualType that are no longer used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44070 91177308-0d34-0410-b5e6-96231b3b80d8
0f84c0059cec39fd1c73ac05bc2864dca664e7f4 13-Nov-2007 Ted Kremenek <kremenek@apple.com> Renamed all serialization "Materialize" methods to "Create" to conform with
the new serialization API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44035 91177308-0d34-0410-b5e6-96231b3b80d8
45ecd5daa36385b7e0b2f657357805e01f5d8cbf 07-Nov-2007 Steve Naroff <snaroff@apple.com> Remove old asserts from ASTContext::isObjcIdType() and isObjcClassType(). Instead, return false if the declarations aren't in scope. This was a hold over from when 'id' and 'Class' were initialized lazily.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43827 91177308-0d34-0410-b5e6-96231b3b80d8
aa499b6ab30975d0cea225f71b33e7ee60b88a1f 05-Nov-2007 Ted Kremenek <kremenek@apple.com> Made methods "Emit" and "Materialize" in ASTContext (used for serialization) public.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43713 91177308-0d34-0410-b5e6-96231b3b80d8
beaf299a2701c5559a4e5d76b0c40f805afb8e6a 03-Nov-2007 Steve Naroff <snaroff@apple.com> Implement rewrite rules for ObjC string constants.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43665 91177308-0d34-0410-b5e6-96231b3b80d8
88a981b47c7face1b1fdaa9074256245107b9ca9 01-Nov-2007 Devang Patel <dpatel@apple.com> Rename classes and collections that maintain record layout information.
Now, at AST level record info is maintained by ASTRecordLayout class.
Now, at code gen level record info is maintained by CGRecordLayout class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43619 91177308-0d34-0410-b5e6-96231b3b80d8
a9a4a24592a2164114a8a36717650e6341eb67a4 01-Nov-2007 Ted Kremenek <kremenek@apple.com> Implemented serialization of QualTypes within ASTContext. Clarified
ownership model of some type pointers. Added FIXMEs to serialization.

Added comments to ASTContext indicating which variables we are intentionally
*not* serializing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43618 91177308-0d34-0410-b5e6-96231b3b80d8
ecb01e666665efabd2aa76a76f6080e2a78965fa 01-Nov-2007 Fariborz Jahanian <fjahanian@apple.com> Remaining work to collect objective-c's type qualifiers and use them to encode
method types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43617 91177308-0d34-0410-b5e6-96231b3b80d8
770951b5bb6028a8d326ddb4a13cef7d4a128162 01-Nov-2007 Chris Lattner <sabre@nondot.org> add support for vector type compatibility checking. Patch by Nate Begeman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43604 91177308-0d34-0410-b5e6-96231b3b80d8
fee0452973f28691a61aab0fb074468ce3e34b9b 31-Oct-2007 Ted Kremenek <kremenek@apple.com> Implemented more of serialization/deserialization for ASTContext. We now
(hypothetically) read in/write out most of the types. Bugs likely exist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43584 91177308-0d34-0410-b5e6-96231b3b80d8
7192f8e9592729882a09d84d77838db26e39ebd4 31-Oct-2007 Ted Kremenek <kremenek@apple.com> Renamed ivar "ArrayTypes" in ASTContext to "ComplexArrayTypes".

Added skeleton code for serialization of ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43558 91177308-0d34-0410-b5e6-96231b3b80d8
8baaca50f07d0c10bba69c8d88c1b9078c92d06d 31-Oct-2007 Anders Carlsson <andersca@mac.com> Encode Class, SEL and Objective-C objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43540 91177308-0d34-0410-b5e6-96231b3b80d8
347b9f33b3216459bcf60cdd52c739fa3028321e 30-Oct-2007 Ted Kremenek <kremenek@apple.com> Added vector to ASTContext to store references to "complete" VLA types
(VLAs with a specified size expresssion). This vector owns the
references to these type objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43502 91177308-0d34-0410-b5e6-96231b3b80d8
7ed05071969757ef84d7fd43168a82cb46d610fd 30-Oct-2007 Fariborz Jahanian <fjahanian@apple.com> Assert if isObjcIdType is called before 'id' type is built.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43484 91177308-0d34-0410-b5e6-96231b3b80d8
2bd24ba6d10f8c811c8e2a57c8397e07082ba497 30-Oct-2007 Ted Kremenek <kremenek@apple.com> VariableArrayTypes (VLAs) without a size expression are now uniqued
and inserted into a FoldingSet owned by ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43482 91177308-0d34-0410-b5e6-96231b3b80d8
33e1d64ab5cd5d27f8530ccd056191fe2c9f3f2e 29-Oct-2007 Fariborz Jahanian <fjahanian@apple.com> Encoding for objectiive-c methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43481 91177308-0d34-0410-b5e6-96231b3b80d8
85f9bceab1542aafff012d4d28e998f4ba16e362 29-Oct-2007 Anders Carlsson <andersca@mac.com> Add (partial) support for @encode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43439 91177308-0d34-0410-b5e6-96231b3b80d8
390d50a725497e99247dc104a7d2c2a255d3af14 17-Oct-2007 Fariborz Jahanian <fjahanian@apple.com> Implementation of AST for @protocol expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43075 91177308-0d34-0410-b5e6-96231b3b80d8
b62f6813406a03bf8a371c4e46c9fad51d102121 16-Oct-2007 Fariborz Jahanian <fjahanian@apple.com> Patch to implement AST generation for objective-c's @selector expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43038 91177308-0d34-0410-b5e6-96231b3b80d8
983df5b2280980e59b0b062bcc2882230465a61e 16-Oct-2007 Steve Naroff <snaroff@apple.com> Emit diagnostics for methods not found.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43037 91177308-0d34-0410-b5e6-96231b3b80d8
2198891824c38d45b2279de5d5e3ef9394eb457c 16-Oct-2007 Steve Naroff <snaroff@apple.com> Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".

This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.

I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43021 91177308-0d34-0410-b5e6-96231b3b80d8
ec0550fa3653d46560bf4484a2e988329c228e39 15-Oct-2007 Steve Naroff <snaroff@apple.com> Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).

This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
if (const RecordType *RT = getAsStructureType())
return !strcmp(RT->getDecl()->getName(), "objc_object");
return false;

...which is now...

bool isObjcIdType(QualType T) const {
return T->getAsStructureType() == IdStructType;

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

- Result = TCE->typesAreCompatible();
+ Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43009 91177308-0d34-0410-b5e6-96231b3b80d8
7e219e47de26346885d667131977bd9ca2d7662a 15-Oct-2007 Steve Naroff <snaroff@apple.com> Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.

Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42983 91177308-0d34-0410-b5e6-96231b3b80d8
b2cf3573d7351094f6247fcca94703ce88eb9ee0 11-Oct-2007 Anders Carlsson <andersca@mac.com> Add __builtin_va_start to the list of builtins, make __builtin_va_list available to builtin functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42857 91177308-0d34-0410-b5e6-96231b3b80d8
4b6c9051c6522894978c9ba6a819a659d102db36 11-Oct-2007 Fariborz Jahanian <fjahanian@apple.com> Patch to create protocol conforming class types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42856 91177308-0d34-0410-b5e6-96231b3b80d8
c7229c338c21ef26b01ef3ecf9eec4fd373fa9ec 07-Oct-2007 Chris Lattner <sabre@nondot.org> move IdentifierTable.h from liblex to libbasic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42730 91177308-0d34-0410-b5e6-96231b3b80d8
f38766870882b8cdd3d9de05f734c024f556b5bc 07-Oct-2007 Chris Lattner <sabre@nondot.org> move ImplementationClassInfo out of ASTContext into Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42714 91177308-0d34-0410-b5e6-96231b3b80d8
29238a0bf7cbf5b396efb451a0adb5fe4aa037ca 05-Oct-2007 Steve Naroff <snaroff@apple.com> Layering refinements for selectors (suggested by Chris). Specifics...

- Add SelectorTable, which enables us to remove MultiKeywordSelector from the public header.
- Remove FoldingSet from IdentifierInfo.h and Preprocessor.h.
- Remove Parser::ObjcGetUnarySelector and Parser::ObjcGetKeywordSelector, they are subsumed by SelectorTable.
- Add MultiKeywordSelector to IdentifierInfo.cpp.
- Move a bunch of selector related methods from ParseObjC.cpp to IdentifierInfo.cpp.
- Added some comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42643 91177308-0d34-0410-b5e6-96231b3b80d8
980e508ca70d6de75d2abfd96b4681fc98bb2698 01-Oct-2007 Steve Naroff <snaroff@apple.com> Move ObjC decls to DeclObjC.h, a new AST header.
Update clients and add to project file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42494 91177308-0d34-0410-b5e6-96231b3b80d8
1b6351f76e1e06893337441641c0e349939afb31 29-Sep-2007 Fariborz Jahanian <fjahanian@apple.com> Patch to remove use of has table for protocol name lookup. This patch mirrors my
previous patch to do the same for class name lookup using a hash table.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42471 91177308-0d34-0410-b5e6-96231b3b80d8
9d048ff59ffb5d41e57297c6509c11920052cf67 29-Sep-2007 Fariborz Jahanian <fjahanian@apple.com> Removed use of hash table for class decls and do a name look up directly.
There is still an issue if doing ScopedLookup is an overkill and we can
just access the decl using the identifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42463 91177308-0d34-0410-b5e6-96231b3b80d8
bcfb06ac6da1aa3c74ac1ef7a49c2807522366e7 29-Sep-2007 Steve Naroff <snaroff@apple.com> Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.

This motivated implementing a devious clattner inspired solution:-)

This approach uses a small value "Selector" class to point to an IdentifierInfo for the 0/1 case. For multi-keyword selectors, we instantiate a MultiKeywordSelector object (previously known as SelectorInfo). Now, the incremental cost for selectors is only 24,800 for Cocoa.h! This saves 156,592 bytes, or 86%!! The size reduction is also the result of getting rid of the AST slot, which was not strictly necessary (we will associate a selector with it's method using another table...most likely in Sema).

This change was critical to make now, before we have too many clients.

I still need to add some comments to the Selector class...will likely add later today/tomorrow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42452 91177308-0d34-0410-b5e6-96231b3b80d8
68d331a78e655d97294e94fcfa63f92cc1f40578 27-Sep-2007 Steve Naroff <snaroff@apple.com> Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set). SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits:

#1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable.

#2: It is more space efficient. Since Cocoa keyword selectors can be quite long, this technique is space saving. For Cocoa.h, pulling the keyword selectors out saves ~180k. The cost of the SelectorInfo data is ~100k. Saves ~80k, or 43%.

#3: It results in many API simplifications. Here are some highlights:

- Removed 3 actions (ActOnKeywordMessage, ActOnUnaryMessage, & one flavor of ObjcBuildMethodDeclaration that was specific to unary messages).
- Removed 3 funky structs from DeclSpec.h (ObjcKeywordMessage, ObjcKeywordDecl, and ObjcKeywordInfo).
- Removed 2 ivars and 2 constructors from ObjCMessageExpr (fyi, this space savings has not been measured).

I am happy with the way it turned out (though it took a bit more hacking than I expected). Given the central role of selectors in ObjC, making sure this is "right" will pay dividends later.

Thanks to Chris for talking this through with me and suggesting this approach.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42395 91177308-0d34-0410-b5e6-96231b3b80d8
ccb4f314248fb2202637d3290f2b17af5646da08 25-Sep-2007 Fariborz Jahanian <fjahanian@apple.com> This patch introduces a new class to keep track of class implementation info. It also adds more
semantic checks for class and protocol declarations. Test cases are good indications of kind of
checking being done in this patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42311 91177308-0d34-0410-b5e6-96231b3b80d8
894c57f565869b26a65436d250a9ca7a04d2abe0 21-Sep-2007 Fariborz Jahanian <fjahanian@apple.com> This patch instantiates objects for forward protocols and in general handles use of
protocols referenced in @protocol declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42191 91177308-0d34-0410-b5e6-96231b3b80d8
bd51b8745c7424fb95abb91370d1a38a24451a6e 20-Sep-2007 Fariborz Jahanian <fjahanian@apple.com> Handle forward declaration of classes and prevent re-instantiation of
ObjcInterfaceClass Objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42172 91177308-0d34-0410-b5e6-96231b3b80d8
1d5b0e37cd569f3d1ddfc5cabff649ef7e42f3c6 20-Sep-2007 Fariborz Jahanian <fjahanian@apple.com> Match to do some semantic analysis on objective-c class decl.
1. Detect used of undeclared/forward declared super class.
2. Detect duplicate definition of a class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42168 91177308-0d34-0410-b5e6-96231b3b80d8
21d5a95b8f50be3e0fdd8c53f92fc201f665a4b4 19-Sep-2007 Steve Naroff <snaroff@apple.com> Remove SelectorTable/SelectorInfo, simply store all selectors in the central IdentifierTable.


We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually).

It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data:

Two tables:

*** Selector/Identifier Stats:
# Selectors/Identifiers: 51635
Bytes allocated: 1999824

One table:

*** Identifier Table Stats:
# Identifiers: 49500
Bytes allocated: 1990316

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42139 91177308-0d34-0410-b5e6-96231b3b80d8
3f128ad2691d299b96663da85a9e069c4081ea7c 17-Sep-2007 Steve Naroff <snaroff@apple.com> Add support for ObjC keyword selectors.

- Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable.
- Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo().
- Add SelectorInfo slot to ObjcMethodDecl.
- Add helper function to derive a SelectorInfo from ObjcKeywordInfo.

Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42023 91177308-0d34-0410-b5e6-96231b3b80d8
b800dc2d5e27ec60f567567b623cdc61152b8fb8 13-Sep-2007 Chris Lattner <sabre@nondot.org> make the sourcemgr available through ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41906 91177308-0d34-0410-b5e6-96231b3b80d8
a9aa5e69d8253e196be90c070738ab5bd9813730 13-Sep-2007 Steve Naroff <snaroff@apple.com> Add ASTContext::StringMap<char> to unique selector names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41894 91177308-0d34-0410-b5e6-96231b3b80d8
3536b443bc50d58a79f14fca9b6842541a434854 06-Sep-2007 Steve Naroff <snaroff@apple.com> The goal of this commit is to get just enough Sema support to recognize Objective-C classes
as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*

The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41752 91177308-0d34-0410-b5e6-96231b3b80d8
bdbf7b030a3e0ddb95240076683830e6f78c79a5 30-Aug-2007 Steve Naroff <snaroff@apple.com> Fix a comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41618 91177308-0d34-0410-b5e6-96231b3b80d8
c9406125e2cac9208098655ac8058c095c2c3a65 30-Aug-2007 Steve Naroff <snaroff@apple.com> Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's.

Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
attributes are not specific to VLA's. Most of them are specific to array parameter types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41616 91177308-0d34-0410-b5e6-96231b3b80d8
fb22d96692c5240fb8d611290dbf7eeed3759c73 30-Aug-2007 Steve Naroff <snaroff@apple.com> Fix the following redefinition errors submitted by Keith Bauer...

[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c
// incorrectly generates redefinition error
extern int array[3];
int array[3];

// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}

It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.

To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.

This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41592 91177308-0d34-0410-b5e6-96231b3b80d8
e00b18cfc3967a0349745055b49d0f3196d28f75 28-Aug-2007 Chris Lattner <sabre@nondot.org> Change EnumDecl to store its corresponding integer type
directly in it. Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41548 91177308-0d34-0410-b5e6-96231b3b80d8
050785860b8541c837982beef3f06d292d1d0c1d 28-Aug-2007 Chris Lattner <sabre@nondot.org> remove dead method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41531 91177308-0d34-0410-b5e6-96231b3b80d8
fb071532de6ebd5685de34d65a5440604ee570bb 27-Aug-2007 Chris Lattner <sabre@nondot.org> constify some stuff

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41503 91177308-0d34-0410-b5e6-96231b3b80d8
6cd862c631eb4fc10755c146bbeaea37c330e815 27-Aug-2007 Chris Lattner <sabre@nondot.org> implement sizeof(enum x), patch inspired by Keith Bauer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41500 91177308-0d34-0410-b5e6-96231b3b80d8
fb0d49669aa370b4c0993c5cee60275ef9fd6518 27-Aug-2007 Steve Naroff <snaroff@apple.com> Replaced ASTContext::maxFloatingType() with ASTContext::compareFloatingType().

Changed Sema::UsualArithmeticConversions to use the new API.

This fixes the following case...

_Complex double X;
double y;

void foo() {
X = X + y;

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -parse-ast-dump
Read top-level variable decl: 'X'
Read top-level variable decl: 'y'

void foo()
(CompoundStmt 0x2605cc0
(BinaryOperator 0x2605ca0 '_Complex double' '='
(DeclRefExpr 0x2605c10 '_Complex double' Decl='X' 0x2605ab0)
(BinaryOperator 0x2605c80 '_Complex double' '+'
(DeclRefExpr 0x2605c30 '_Complex double' Decl='X' 0x2605ab0)
(ImplicitCastExpr 0x2605c70 '_Complex double'
(DeclRefExpr 0x2605c50 'double' Decl='y' 0x2605ae0)))))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41483 91177308-0d34-0410-b5e6-96231b3b80d8
716c7304ff5d27a95e1e7823acd1d09d5ec3e37f 27-Aug-2007 Steve Naroff <snaroff@apple.com> Tweak a comment and assert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41475 91177308-0d34-0410-b5e6-96231b3b80d8
f1448a0e4a1e868ff873a8530a61a09cb68666cc 27-Aug-2007 Steve Naroff <snaroff@apple.com> Replaced ASTContext::maxComplexType() with ASTContext::getFloatingTypeOfSizeWithinDomain().

Changed Sema::UsualArithmeticConversions to correctly implement complex/float conversions,
using maxFloatingType() with getFloatingTypeOfSizeWithinDomain().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41474 91177308-0d34-0410-b5e6-96231b3b80d8
71993dd85eed9cc42c6b2fa61ee5c53026b74817 17-Aug-2007 Anders Carlsson <andersca@mac.com> Add initial support for constant CFStrings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41136 91177308-0d34-0410-b5e6-96231b3b80d8
8d1a3b8ca1e5fcc4567b5a6f51d82be2e460de1c 01-Aug-2007 Steve Naroff <snaroff@apple.com> Two typeof() related changes...

- Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
- Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
for error diagnostics (since it's more natural to display the expressions type).

One "random" (or at least delayed:-) change...

- Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
an issue, we can revisit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40676 91177308-0d34-0410-b5e6-96231b3b80d8
d1861fd633d5096a00777c918eb8575ea7162fe7 31-Jul-2007 Steve Naroff <snaroff@apple.com> Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631 91177308-0d34-0410-b5e6-96231b3b80d8
73322924127c873c13101b705dd823f5539ffa5f 18-Jul-2007 Steve Naroff <snaroff@apple.com> First round of extended vector support. Here is an overview...

- added ocu_vector_type attribute, Sema::HandleOCUVectorTypeAttribute().
- added new AST node, OCUVectorType, a subclass of VectorType.
- added ASTContext::getOCUVectorType.
- changed ASTContext::convertToVectorType() to ASTContext::getVectorType(). This is
unrelated to extended vectors, however I was in the vicinity and it was on my todo list.
Added a FIXME to Sema::HandleVectorTypeAttribute to deal with converting complex types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40007 91177308-0d34-0410-b5e6-96231b3b80d8
464175bba1318bef7905122e9fda20cff926df78 18-Jul-2007 Chris Lattner <sabre@nondot.org> initial layout support for structures and unions. This isn't actually
hooked up to anything, so it's not very useful yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40006 91177308-0d34-0410-b5e6-96231b3b80d8
d2d2a11a91d7ddf468bfb70f66362d24806ed601 14-Jul-2007 Chris Lattner <sabre@nondot.org> A significant refactoring of the type size stuff to also
compute type alignment. This info is needed for struct layout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39850 91177308-0d34-0410-b5e6-96231b3b80d8
a7674d8a9a69f3f6fe16e70cf2a3b2b15fb7c43d 14-Jul-2007 Chris Lattner <sabre@nondot.org> Move getSize() out of type, into ASTContext, where it has target info, and
where ASTContext can manage caches for struct layout, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39835 91177308-0d34-0410-b5e6-96231b3b80d8
8b9023ba35a86838789e2c9034a6128728c547aa 13-Jul-2007 Chris Lattner <sabre@nondot.org> Implement codegen for + and - with pointers. Patch contributed by
Keith Bauer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39793 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