History log of /external/clang/lib/Serialization/ASTWriter.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
51e75aecf4fb303b91c9e54fd88e3509e5acc7a6 07-Aug-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Fix a PCH serialization crash, with invalid code related to forward enum references.

The problem was that an enum without closing semicolon could be associated as a forward enum
in an erroneous declaration, leading to the identifier being associated with the enum decl but
without a declaration actually referencing it.
This resulted in not having it serialized before serializing the identifier that is associated with.

Also prevent the ASTUnit from querying the serialized DeclID for an invalid top-level decl; it may not
have been serialized.

rdar://14539667

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
b22d19493d479bf3ed6e5e60bfcf7047823da7fc 22-Jul-2013 Douglas Gregor <dgregor@apple.com> Make modules depend on the compiler's own module.map, as a proxy for the compiler itself.

The headers in the compiler's own resource include directory are
system headers, which means we don't stat() them eagerly when loading
a module. Use module.map as a proxy for these headers and the compiler
itself. Fixes <rdar://problem/13856838>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
97a03cf921ccc16ef9d16d965a5ef28631090f6a 11-Jul-2013 Eli Bendersky <eliben@google.com> Simplify GetBuiltinNames by hoising the NoBuiltins argument out of it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
09d19efaa147762f84aed55efa7930bb3616a4e5 04-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4fc5089e306fe606f2e3e4fa58063ebab35deb62 26-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Lazily deserialize the "first' friend declaration when deserializing a class
declaration. This PCH a little lazier, and breaks a deserialization cycle that
causes crashes with modules enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
bc3f628815b3841dc99109e7f67f9afa7793bc94 20-Jun-2013 Lawrence Crowl <crowl@google.com> This patch adds new private headers to the module map. Private
headers may be included from within the module, but not from outside
the module.



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

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

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cc8e22b4e940a6d74174343ec16547e3bb52e630 21-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Revert r182331, these checks should be based on the target not the host.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7efb8af368309b5a2e5f9fa4df6da136d1c5ac54 21-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Move two Darwin-specific hacks into #ifdef __APPLE__. These were stat'ing
nonexistent Darwin-specific files on every module build.


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

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9dadfab2faebe40e7dbbfd0801c15174b69bd726 11-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y deduced return types: when we deduce a return type for a function which
we loaded from PCH, if we're building another PCH, create an update record to
patch the return type of the earlier declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d3220dbeeadc4ac54ceecea8cf63f8d8be291d2a 09-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] When building a module, make sure we don't serialize out HeaderFileInfo for headers not belonging to the module.

After r180934 we may initiate module map parsing for modules not related to the module what we are building,
make sure we ignore the header file info of headers from such modules.

First part of rdar://13840148

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
aeeacf725c9e0ddd64ea9764bd008e5b6873ce51 03-May-2013 John McCall <rjmccall@apple.com> Move parsing of identifiers in MS-style inline assembly into
the actual parser and support arbitrary id-expressions.

We're actually basically set up to do arbitrary expressions here
if we wanted to.

Assembly operands permit things like A::x to be written regardless
of language mode, which forces us to embellish the evaluation
context logic somewhat. The logic here under template instantiation
is incorrect; we need to preserve the fact that an expression was
unevaluated. Of course, template instantiation in general is fishy
here because we have no way of delaying semantic analysis in the
MC parser. It's all just fishy.

I've also fixed the serialization of MS asm statements.

This commit depends on an LLVM commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
65110caf70bc6c07c3bc223acf03643af47a6643 26-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH/modules] Require the preprocessing record option to match the used PCH, if modules are enabled.

The preprocessing record becomes important when modules are enabled, since it is used to calculate the
module cache hash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0532df02a72a32a6042e961b71989db73d0d0a22 26-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Modules] Fix an issue where the reconstructed redeclaration chain was incomplete, missing the definition from a module.

-Make sure that a deserialized external decl gets added to the TU scope.
-When associating an identifier with a set of decls, use the most recent local ones,
if they exist, otherwise associating decls from modules (that came after a local one)
will lead to an incomplete reconstructed re-declaration chain.

rdar://13712705

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
2e3d8c0815acaf1bc5995ebe56cea07471e5c9c7 17-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Enhance the ObjC global method pool to record whether there were 0, 1, or >= 2 methods (with a particular selector) inside categories.

This is done by extending ObjCMethodList (which is only used by the global method pool) to have 2 extra bits of information.
We will later take advantage of this info in global method pool for the overridden methods calculation.

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

Patch by Tong Shen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6fd7d3067dd06584ef3940e88e31fea1a0e83588 10-Apr-2013 Dmitri Gribenko <gribozavr@gmail.com> Add an option to parse all comments as documentation comments

Patch by Amin Shali.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4382867f04549f9bfcd33a08342f4f74ab13841c 04-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Pare back r164351 somewhat. The problem that change was addressing was that we
don't serialize a lookup map for the translation unit outside C++ mode, so we
can't tell when lookup within the TU needs to look within modules. Only apply
the fix outside C++ mode, and only to the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b2dbfd8669282915c9466ba88c66f9791b946efa 03-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] If a submodule has re-definitions of the same macro, only the last definition will be used as the "exported" one.

Fixes rdar://13562262

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ea744ab5f39b8f45f802301841b77398166bce8f 27-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Make sure enabled diagnostic pragmas inside the module don't affect the translation unit that
imports the module.

Getting diagnostic sections from modules properly working is a fixme.

rdar://13516663

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c56fff7fd231aebf4b152f60f8f11ef91835c48a 26-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Preprocessor/Modules] Separate the macro directives kinds into their own MacroDirective's subclasses.

For each macro directive (define, undefine, visibility) have a separate object that gets chained
to the macro directive history. This has several benefits:

-No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like
PPMutationListener become unnecessary.
-No need to keep extra source locations for the undef/visibility locations for the define directive object
(which is the majority of the directives)
-Much easier to hide/unhide a section in the macro directive history.
-Easier to track the effects of the directives across different submodules.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9317ab94bb68122ba6fc728eb73c1308fb913cd1 22-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH/Modules] De/Serialize MacroInfos separately than MacroDirectives.

-Serialize the macro directives history into its own section
-Get rid of the macro updates section
-When de/serializing an identifier from a module, associate only one macro per
submodule that defined+exported it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
906d66acc5cf2679453e10a4f0a67feedd765b21 20-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, and warn when a newly-imported module conflicts with an already-imported module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2bf383d6f5886b69922685207d9d5a84d81afec8 20-Mar-2013 Douglas Gregor <dgregor@apple.com> Only introduce the SDKSettings.plist dependency in modules/PCH files that don't depend on any other modules or PCH files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
63a726870b486e0470c3a4b11cf62bab8be00b73 20-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/10796651> Introduce configuration macros into module maps.

Configuration macros are macros that are intended to alter how a
module works, such that we need to build different module variants
for different values of these macros. A module can declare its
configuration macros, in which case we will complain if the definition
of a configation macro on the command line (or lack thereof) differs
from the current preprocessor state at the point where the module is
imported. This should eliminate some surprises when enabling modules,
because "#define CONFIG_MACRO ..." followed by "#include
<module/header.h>" would silently ignore the CONFIG_MACRO setting. At
least it will no longer be silent about it.

Configuration macros are eventually intended to help reduce the number
of module variants that need to be built. When the list of
configuration macros for a module is exhaustive, we only need to
consider the settings for those macros when building/finding the
module, which can help isolate modules for various project-specific -D
flags that should never affect how modules are build (but currently do).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
677e15ffee2ecc9c1c8f46fd77cab4b5afb59640 19-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13363214> Eliminate race condition between module rebuild and the global module index.

The global module index was querying the file manager for each of the
module files it knows about at load time, to prune out any out-of-date
information. The file manager would then cache the results of the
stat() falls used to find that module file.

Later, the same translation unit could end up trying to import one of the
module files that had previously been ignored by the module cache, but
after some other Clang instance rebuilt the module file to bring it
up-to-date. The stale stat() results in the file manager would
trigger a second rebuild of the already-up-to-date module, causing
failures down the line.

The global module index now lazily resolves its module file references
to actual AST reader module files only after the module file has been
loaded, eliminating the stat-caching race. Moreover, the AST reader
can communicate to its caller that a module file is missing (rather
than simply being out-of-date), allowing us to simplify the
module-loading logic and allowing the compiler to recover if a
dependent module file ends up getting deleted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9cc3ed4e4d7f25b1af8ba7b85d324a0bb8747640 15-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Don't record the macros from the predefines buffer.

These will be available in the current translation unit anyway, for
modules they only waste space and deserialization time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4a18c3b25a2d7eb7f770ce91ee5e14433b2a1cb6 15-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13426257> Introduce SDKSettings.plist as an input file dependency for PCH/modules.

When we're building a precompiled header or module against an SDK on
Darwin, there will be a file SDKSettings.plist in the sysroot. Since
stat()'ing every system header on which a module or PCH file depends
is performance suicide, we instead stat() just SDKSettings.plist. This
hack works well on Darwin; it's unclear how we want to handle this on
other platforms. If there is a canonical file, we should use it; if
not, we either have to take the performance hit of stat()'ing system
headers repeatedly or roll the dice by not checking anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177194 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
faf01f02f6f3844cec6c2ddca297b4f33b361960 14-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Don't write the UnusedFileScopedDecls vector to the module file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
975d353997a13f7dfdaf4ec7a547fe1adb15f35e 14-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Check for delegating constructor cycles when building a module and don't write them out to the module file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
55ea75bf61a5d76f6453513d937944ce68181c6a 13-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Modules] Don't eagerly load and associate all the module header files.

In a module-enabled Cocoa PCH file, we spend a lot of time stat'ing the headers
in order to associate the FileEntries with their modules and support implicit
module import.

Use a more lazy scheme by enhancing HeaderInfoTable to store extra info about
the module that a header belongs to, and associate it with its module only when
there is a request for loading the header info for a particular file.

Part of rdar://13391765

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c1d22393628a145e54396c0ac66e9625d13a7658 13-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Modules] Resolve top-headers of modules lazily.

This allows resolving top-header filenames of modules to FileEntries when
we need them, not eagerly.

Note that that this breaks ABI for libclang functions
clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders
but this is fine because they are experimental and not widely used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
398253ab0e0dedc6f5ddb1bad2ac6a084d0d88a8 06-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When pre-validating the headers from the PCH, only validate non-system headers.

Stat'ing all the headers from the PCH to make sure they are up-to-date takes significant time.
In a particular source file (whose PCH file included Cocoa.h) from total -fsyntax-only time
12% was just stat calls. Change pre-validation to only check non-system headers.

There are some notable disadvantages:

-If a system header, that is not include-guarded, changes after the PCH was created, we will not
find it in the header info table and we will #import it, effectively #importing it twice, thus
we will emit some error due to a multiple definition and after that the "header was modified" error will likely
be emitted, for example something like:

NSDictionary.h:12:1: error: duplicate interface definition for class 'NSDictionary'
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
^
NSDictionary.h:12:12: note: previous definition is here
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
^
fatal error: file 'NSDictionary.h' has been modified since the precompiled header was built

Though we get the "header was modified" error, this is a bit confusing.

-Theoretically it is possible that such a system header will cause no errors but it will just cause an
unfortunate semantic change, though I find this rather unlikely.

The advantages:

-Reduces compilation time when using a huge PCH like the Cocoa ones
-System headers change very infrequent and when they do, users/build systems should be able to know that
re-building from scratch is needed.

Addresses rdar://13056262

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ed3802e5da6e7d41975b1cb3d7ae3a3b9e855d10 06-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] For HeaderFileInfoTrait, hash the key using size & time of the file.

Previously the hash would be the filename portion of the path, which could be
different for a filename with different case or a symbolic link with a different
name completely.
This did not actually create any issue so far because by validating all headers
in the PCH we created uniqued FileEntries based on inodes, so an #include of
a symbolic link (refering to a file from the PCH) would end up with a FileEntry
with filename same as the one recorded in the PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176566 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9b5b65957c6830af92dd1d62cbf8e341c95bc283 01-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Remove building a SmallPtrSet that is not actually used for anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6ebf09130479bc7605aa09a3e6c4dc2ba3513495 22-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Comment parsing: add CommentOptions to allow specifying custom comment block commands

Add an ability to specify custom documentation block comment commands via a new
class CommentOptions. The intention is that this class will hold future
customizations for comment parsing, including defining documentation comments
with specific numbers of parameters, etc.

CommentOptions instance is a member of LangOptions.

CommentOptions is controlled by a new command-line parameter
-fcomment-block-commands=Foo,Bar,Baz.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
9818a1d443e97677dd3422305de9cc2b1fb2a8c1 20-Feb-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Split the MacroInfo class into two separate concepts, MacroInfo class
for the data specific to a macro definition (e.g. what the tokens are), and
MacroDirective class which encapsulates the changes to the "macro namespace"
(e.g. the location where the macro name became active, the location where it was undefined, etc.)

(A MacroDirective always points to a MacroInfo object.)

Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but
splitting the concepts allows us to better model the effect of modules to the macro namespace
(also as a bonus it allows better modeling of push_macro/pop_macro #pragmas).
Modules can have their own macro history, separate from the local (current translation unit)
macro history; MacroDirectives will be used to model the macro history (changes to macro namespace).

For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created
to indicate that "FOO" became active at the import location. Module "A" itself will contain another
MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives
will point to the same MacroInfo object.

Introducing the separation of macro concepts is the first part towards better modeling of module macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
aa945900d5438984bdcaac85c4f54868292231f4 18-Feb-2013 Douglas Gregor <dgregor@apple.com> Ensure that the identifier chains have the most recent declaration after module deserialization.

This commit introduces a set of related changes to ensure that the
declaration that shows up in the identifier chain after deserializing
declarations with a given identifier is, in fact, the most recent
declaration. The primary change involves waiting until after we
deserialize and wire up redeclaration chains before updating the
identifier chains. There is a minor optimization in here to avoid
recursively deserializing names as part of looking to see whether
top-level declarations for a given name exist.

A related change that became suddenly more urgent is to property
record a merged declaration when an entity first declared in the
current translation unit is later deserialized from a module (that had
not been loaded at the time of the original declaration). Since we key
off the canonical declaration (which is parsed, not from an AST file)
for emitted redeclarations, we simply record this as a merged
declaration during AST writing and let the readers merge them.

Re-fixes <rdar://problem/13189985>, presumably for good this time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2d1ece81a5c47eebbaa6ad6de70714ac7ff973c2 08-Feb-2013 Douglas Gregor <dgregor@apple.com> Always keep highest identifier, selector, and macro IDs when we've
read another one, just as we do for types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4fd83a3813fde17d6077bb18363aa4339e38f641 05-Feb-2013 Ted Kremenek <kremenek@apple.com> Remove dead code related to the now defunct PCH stat cache.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cd0655b17249c4c4908ca91462657f62285017e6 01-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Add a new -Wundefined-inline warning for inline functions which are used but not
defined. Fixes PR14993!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
995e26b0523ac8e3b6199a509b871b81fa5df6ee 31-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Remove elements from Sema.UndefinedInternals as functions are defined. Also
filter the elements before emitting them into a PCH. No user-visible
functionality change, except that PCH files may be smaller?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
59fd63581d6d572f23e82e81a50e0b940c8d1089 30-Jan-2013 Daniel Dunbar <daniel@zuster.org> [Frontend] Remove HeaderSearchOptions::Entry::IsInternal, which is unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ef84554239d77cc52a14b42f2bff8c2d02e7630e 30-Jan-2013 Daniel Dunbar <daniel@zuster.org> [Frontend] Add an ExternCSystem include entry group.

- The only group where it makes sense for the "ExternC" bit is System, so this
simplifies having to have the extra isCXXAware (or ImplicitExternC, depending
on what code you talk to) bit caried around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
01a41140cd8ec9475ed0c33384310fbdd3b6de11 26-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Preserve Sema::UndefinedInternals across PCH boundaries. Fixes
-Wundefined-internal warnings with PCH.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
eab6652b7e417c8e46b21c7d340f3a7d41492d6e 25-Jan-2013 Daniel Dunbar <daniel@zuster.org> [Frontend] Remove another IsUserSpecified member variable that is now unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5a04f9fc2b000da98fd903c8156034304bdadb2f 21-Jan-2013 Douglas Gregor <dgregor@apple.com> Introduce a fast path for the ASTReader's name lookup within a
DeclContext. When the DeclContext is of a kind that can only be
defined once and never updated, we limit the search to the module file
that conatins the lookup table. Provides a 15% speedup in one
modules-heavy source file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173050 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
dc1088f6201c3fb8f3f97f54c343f7d163fbec06 19-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH/Modules] Revert r172843, it caused a module to fail building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f953276b6165dc7e8f4679cce4d0e7c649cd4232 18-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!

Makes sure that a deserialized macro is only added to the preprocessor macro definitions only once.
Unfortunately I couldn't get a reduced test case.

rdar://13016031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4f45bc099f2665bc6e4bcbb169aa452390dbf3fe 18-Jan-2013 Will Dietz <wdietz2@illinois.edu> [ubsan] Add support for -fsanitize-blacklist

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d3b036efdf0bf4ec216c701183a4b990cd041cd6 18-Jan-2013 Douglas Gregor <dgregor@apple.com> Revert Clang r172620 and r172629, which caused a hang when building
complicated modules (<rdar://problem/13038265>). Unfortunately, this
un-fixes <rdar://problem/13016031>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d329724745b49f894b768d47275b7c2713106e89 17-Jan-2013 Douglas Gregor <dgregor@apple.com> Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

visible_categories_iterator: Iterates over all visible categories
and extensions, hiding any that have their "hidden" bit set. This is
by far the most commonly used iterator.

known_categories_iterator: Iterates over all categories and
extensions, ignoring the "hidden" bit. This tends to be used for
redeclaration-like traversals.

visible_extensions_iterator: Iterates over all visible extensions,
hiding any that have their "hidden" bit set.

known_extensions_iterator: Iterates over all extensions, whether
they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7f69b1ab4f63ded511dddd7fb7e1cd8860757016 16-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH/Modules] Change how macro [re]definitions are de/serialized.

Previously we would serialize the macro redefinitions as a list, part of
the identifier, and try to chain them together across modules individually
without having the info that they were already chained at definition time.

Change this by serializing the macro redefinition chain and then try
to synthesize the chain parts across modules. This allows us to correctly
pinpoint when 2 different definitions are ambiguous because they came from
unrelated modules.

Fixes bogus "ambiguous expansion of macro" warning when a macro in a PCH
is redefined without undef'ing it first.

rdar://13016031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
644448393e5592563f5f53842e1b0c6299f31d6c 15-Jan-2013 David Greene <greened@obbligato.org> Fix Casting

Make the const_cast explicit to silence a compiler warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6cbe517237c3c223beb064d60d5b49e56d65c06 14-Jan-2013 Douglas Gregor <dgregor@apple.com> Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.

The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,

link "clangAST"

or

link framework "MyFramework"

Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.

For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.



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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5ea6ef490547917426d5e2ed14c9f36521bbeacf 11-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Truth in advertising: LocallyScopedExternalDecls actually only contains
external declarations with C language linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8169b671974fc15b6059b1e9532f7f3207d79786 07-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] (De)serialize the end location of MacroInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
589dae7d52043af6085967fae0c31d32365de229 07-Jan-2013 Douglas Gregor <dgregor@apple.com> updateOutOfDateIdentifier() can cause the identifier table to be
rehashed, invaliding the iterator walking through the identifier
table. Separate out the identification of out-of-date identifiers from
updating them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3bc93e3124ad5e7191c4a12dc981c8ee53578193 19-Dec-2012 David Blaikie <dblaikie@gmail.com> Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365

This does limit these typedefs to being sequences, but no current usage
requires them to be contiguous (we could expand this to a more general
iterator pair range concept at some point).

Also, it'd be nice if SmallVector were constructible directly from an ArrayRef
but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the
inverse conversion. (& generalizing over all range-like things, while nice,
would require some nontrivial SFINAE I haven't thought about yet)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5e24f2d83099bb557b1d39c6420787eeaf072a81 13-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Make the new PCH format (control block) backwards compatible and
don't crash when loading a PCH with the older format.

The introduction of the control block broke compatibility with PCHs from
older versions. This patch allows loading (and rejecting) PCHs from an older
version and allows newer PCHs to be rejected from older clang versions as well.

rdar://12821386

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a89b618a04409c93b3b3c56d606a97a317567436 11-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When writing out the list of input files, avoid emitting duplicate
entries of the same file.

This can happen because the file was "included" multiple times and is
referenced by multiple SLocEntries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169829 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bc2a35d5ff492107dab5bdb7682f0da2f4a88861 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Finish implementing 'selected constructor' rules for triviality in C++11. In
the cases where we can't determine whether special members would be trivial
while building the class, we eagerly declare those special members. The impact
of this is bounded, since it does not trigger implicit declarations of special
members in classes which merely *use* those classes.

In order to determine whether we need to apply this rule, we also need to
eagerly declare move operations and destructors in cases where they might be
deleted. If a move operation were supposed to be deleted, it would instead
be suppressed, and we could need overload resolution to determine if we fall
back to a trivial copy operation. If a destructor were implicitly deleted,
it would cause the move constructor of any derived classes to be suppressed.

As discussed on cxx-abi-dev, C++11's selected constructor rules are also
retroactively applied as a defect resolution in C++03 mode, in order to
identify that class B has a non-trivial copy constructor (since it calls
A's constructor template, not A's copy constructor):

struct A { template<typename T> A(T &); };
struct B { mutable A a; };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d5bc867f6597ee8d4eb31ea217934e436fc7c7e3 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++03 [dcl.init]p5's checking for value-initialization of references
properly, rather than faking it up by pretending that a reference member makes
the default constructor non-trivial. That leads to rejects-valids when putting
such types inside unions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7d04d3a6855bc74d5c1a2213717eb5402b772ae6 30-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Refactor to reduce duplication in handling of special member functions. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
acf796b4797c5b3e9e237148fa622afdc04b3eff 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Store on the CXXRecordDecl whether the class has, or would have, a copy
constructor/assignment operator with a const-qualified parameter type. The
prior method for determining this incorrectly used overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2a82ca255b0f99f6201a75ed52b91fc024f6e9cf 28-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce ASTUnresolvedSet, an UnresolvedSet-like class, whose contents are
allocated using the allocator associated with an ASTContext.

Use this inside CXXRecordDecl::DefinitionData instead of an UnresolvedSet to
avoid a potential memory leak.

rdar://12761275

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
992d91742129c1f77563df0b3d0a40b36fd13e3e 15-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Use a memory buffer directly as input for the module includes,
instead of messing with virtual files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
958bcaf3d4e0c1ae46de3e84e7c2a7638c3c5286 15-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Setup the import location of a module file and use it
as the include location of the main file of an imported module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4fa4b480270c14dfdcd0dfd4f76938e973082e3b 14-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Suppress elided variadic macro argument extension diagnostic for macros using
the related comma pasting extension.

In certain cases, we used to get two diagnostics for what is essentially one
extension. This change suppresses the first diagnostic in certain cases
where we know we're going to print the second diagnostic. The
diagnostic is redundant, and it can't be suppressed in the definition
of the macro because it points at the use of the macro, so we want to
avoid printing it if possible.

The implementation works by detecting constructs which look like comma
pasting at the time of the definition of the macro; this information
is then used when the macro is used. (We can't actually detect
whether we're using the comma pasting extension until the macro is
actually used, but we can detecting constructs which will be comma
pasting if the varargs argument is elided.)

<rdar://problem/12292192>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4182ed686283b72736b287cbe28583cb641f8934 31-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Remove the stat cache from the PCH file.

The stat cache became essentially useless ever since we started
validating all file entries in the PCH.
But the motivating reason for removing it now is that it also affected
correctness in this situation:

-You have a header without include guards (using "#pragma once" or #import)
-When creating the PCH:
-The same header is referenced in an #include with different filename cases.
-In the PCH, of course, we record only one file entry for the header file
-But we cache in the PCH file the stat info for both filename cases

-Then the source files are updated and the header file is updated in a way that
its size and modification time are the same but its inode changes

-When using the PCH:
-We validate the headers, we check that header file and we create a file entry with its current inode
-There's another #include with a filename with different case than the previously created file entry
-In order to get its stat info we go through the cached stat info of the PCH and we receive the old inode
-because of the different inodes, we think they are different files so we go ahead and include its contents.

Removing the stat cache will potentially break clients that are attempting to use the stat cache
as a way of avoiding having the actual input files available. If that use case is important, patches are welcome
to bring it back in a way that will actually work correctly (i.e., emit a PCH that is self-contained, coping with
literal strings, line/column computations, etc.).

This fixes rdar://5502805

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
33e1576ef88ae6fcc4ed8686f34ed28b1a41bcce 30-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] The diagnostic state points can refer to previously created
diagnostic states; make sure the ASTReader sets the diagnostic state
properly instead of always recreating it.

Fixes rdar://12581618 & http://llvm.org/PR14181

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4c0c7e86645dfa1719d17d70e009ab49347aba62 25-Oct-2012 Douglas Gregor <dgregor@apple.com> Teach the PCH validator to check the preprocessor options, especially
the macros that are #define'd or #undef'd on the command line. This
checking happens much earlier than the current macro-definition
checking and is far cleaner, because it does a direct comparison
rather than a diff of the predefines buffers. Moreover, it allows us
to use the result of this check to skip over PCH files within a
directory that have non-matching -D's or -U's on the command
line. Finally, it improves the diagnostics a bit for mismatches,
fixing <rdar://problem/8612222>.

The old predefines-buffer diff'ing will go away in a subsequent commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a71a7d8a1ce4474e7bdb680658fb58b6caf391d3 24-Oct-2012 Douglas Gregor <dgregor@apple.com> (De-)serialize the preprocessor options, including macros defined,
-include'd files, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bbf38319edd4eddc55ec273934e990d7e84991de 24-Oct-2012 Douglas Gregor <dgregor@apple.com> (De-)serialize header search options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1b2c3c0884e917ae5d59edde7d93b2af33c6a1b6 24-Oct-2012 Douglas Gregor <dgregor@apple.com> (De-)serialize the file system options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5f3d8224af99ad0d9107601c0c31b74693371cc1 24-Oct-2012 Douglas Gregor <dgregor@apple.com> Serialize DiagnosticOptions to the AST file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a930dc9b46572cb6e5bb54f3d724e8fe23a6b66e 22-Oct-2012 Douglas Gregor <dgregor@apple.com> Eliminate the redundancy between source-file information in the source
manager block and input-file information in the control block. The
source manager entries now point back into the control block. Input
files are now lazily deserialized (if validation is disabled). Reduces
Cocoa's PCH by the ~70k I added when I introduced the redundancy in
r166251.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bacc2c543c2236c5add893fabd8ecb798c1cdd76 19-Oct-2012 NAKAMURA Takumi <geek4civic@gmail.com> ASTWriter.cpp: Fix a warning. [-Wunused-variable]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c337fefd7317714d365a2acf4f1d2939bbcf8e3b 19-Oct-2012 Douglas Gregor <dgregor@apple.com> Describe the new input-files block and its record, for llvm-bcanalyzer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
745e6f168d0276c15fb72f3d90e3d93d60282b1b 19-Oct-2012 Douglas Gregor <dgregor@apple.com> Move the set of files to be validated in an AST file into the control
block, so the input files are validated early on, before we've
committed to loading the AST file. This (accidentally) fixed a but
wherein the main file used to generate the AST file would *not* be
validated by the existing validation logic.

At the moment, this leads to some duplication of filenames between the
source manager block and input-file blocks, as well as validation
logic. This will be handled via an upcoming patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
39c497b6d5e99acecbe03ee173249ee21933e855 18-Oct-2012 Douglas Gregor <dgregor@apple.com> Collapse the original file name and original file ID records into a
single record.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7ae467f02b0f2ba3897ee03e0d011433789b5434 18-Oct-2012 Douglas Gregor <dgregor@apple.com> Collapse the "version control revision/tag" AST file record into the
metadata record, which already had other version information. Clean up
the block info block along the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ee097c1a3f5e02605dd585c0a9bf22976f09ccc2 18-Oct-2012 Douglas Gregor <dgregor@apple.com> Split the target options out into their own record within the AST
file's control block.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166195 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1d9d9898ce2b338314161d92f39561a09a2a8b6f 18-Oct-2012 Douglas Gregor <dgregor@apple.com> Start factoring the on-disk records for an AST file into a control
block, which stores information about how the AST file to generated,
from the AST block, which stores the actual serialized AST. The
information in the control block should be enough to determine whether
the AST file is up-to-date and compatible with the current translation
unit, and reading it should not cause any side effects that aren't
easy to undo. That way, we can back out from an attempt to read an
incompatible or out-of-date AST file.

Note that there is still more factoring to do. In particular,
information about the source files used to generate the AST file
(along with their time stamps, sizes, etc.) still resides in the
source manager block.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
57016dda61498294120b1a881d9e6606337b29d9 17-Oct-2012 Douglas Gregor <dgregor@apple.com> Serialize TargetOptions into an AST file, and make sure that we keep
target options around so they can be accessed at any point (rather
than keeping them transient).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166072 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2b49d1f0ad790a8a5d514af1be211591a746cb73 15-Oct-2012 Douglas Gregor <dgregor@apple.com> Introduce the notion of excluded headers into the module map
description. Previously, one could emulate this behavior by placing
the header in an always-unavailable submodule, but Argyrios guilted me
into expressing this idea properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
54c8a40ed658676b1f3f983728feae488c501477 12-Oct-2012 Douglas Gregor <dgregor@apple.com> Track which particular submodule #undef's a macro, so that the actual
#undef only occurs if that submodule is imported.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
900ab95e12bb7483971640a91075699eec391804 11-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Improve AST serialization done by ASTUnit::Save().

The ASTUnit needs to initialize an ASTWriter at the beginning of
parsing to fully handle serialization of a translation unit that
imports modules. Do this by introducing an option to enable it, which
corresponds to CXTranslationUnit_ForSerialization on the C API side.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4145228b758892afd3545835a4caaea722f20510 11-Oct-2012 Douglas Gregor <dgregor@apple.com> Remove the ASTDeserializationListener's MacroVisible() callback, which
is no longer necessary, as well as the little bit of infrastructure in
the AST writer that used it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165684 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7097be90d3549c30438b7a94b35577003d0a434f 11-Oct-2012 Douglas Gregor <dgregor@apple.com> Remove an unused bit from the serialized IdentifierInfo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6c6c54a59a6e7dbe63ff6a9bbab76f6e0c7c8462 11-Oct-2012 Douglas Gregor <dgregor@apple.com> Deserialize macro history when we deserialize an identifier that has
macro history.

When deserializing macro history, we arrange history such that the
macros that have definitions (that haven't been #undef'd) and are
visible come at the beginning of the list, which is what the
preprocessor and other clients of Preprocessor::getMacroInfo()
expect. If additional macro definitions become visible later, they'll
be moved toward the front of the list. Note that it's possible to have
ambiguities, but we don't diagnose them yet.

There is a partially-implemented design decision here that, if a
particular identifier has been defined or #undef'd within the
translation unit, that definition (or #undef) hides any macro
definitions that come from imported modules. There's still a little
work to do to ensure that the right #undef'ing happens.

Additionally, we'll need to scope the update records for #undefs, so
they only kick in when the submodule containing that update record
becomes visible.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165682 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a8235d6c4093cd38dcf742909651f867de62e55b 10-Oct-2012 Douglas Gregor <dgregor@apple.com> Rework the (de-)serialization of macros, as stored in
MacroInfo*. Instead of simply dumping an offset into the current file,
give each macro definition a proper ID with all of the standard
modules-remapping facilities. Additionally, when a macro is modified
in a subsequent AST file (e.g., #undef'ing a macro loaded from another
module or from a precompiled header), provide a macro update record
rather than rewriting the entire macro definition. This gives us
greater consistency with the way we handle declarations, and ties
together macro definitions much more cleanly.

Note that we're still not actually deserializing macro history (we
never were), but it's far easy to do properly now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3644d970095d9c638c658cfd17f8e19fc333aadc 09-Oct-2012 Douglas Gregor <dgregor@apple.com> If a macro has been #undef'd in a precompiled header, we still need to
write out the macro history for that macro. Similarly, we need to cope
with reading a macro definition that has been #undef'd.

Take advantage of this new ability so that global code-completion
results can refer to #undef'd macros, rather than losing them
entirely. For multiply defined/#undef'd macros, we will still get the
wrong result, but it's better than getting no result.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c7782d96c657eeb767bfea5117db49dc40e6356c 05-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Modules] Introduce Module::TopHeaders which is a set of top-level headers
that are associated with a (sub)module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
59c0a818a79be850f7ae8fdafd57a1710e5b809a 04-Oct-2012 Abramo Bagnara <abramo.bagnara@bugseng.com> Fixed FunctionTypeLoc source range.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a2ea4d94f2133aad0d864cf1327af142a47ffb09 02-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH/Module] Change the map of file-level DeclIDs to use a FileID
as key instead of a SLocEntry pointer. This allows the array of
file sorted declarations in a PCH/module to be deterministic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2093e0bc4e436b1b2791d5423fb3274dd37231b8 02-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When indexing an AST file, only deserialize the file level
declarations of the current primary module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8dd927cf03e85b942f323eebb42e06c839887ebb 02-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add info in the preprocessing record whether an inclusion directive
resulted in an automatic module import.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d7a6b1640e565487d163023a6a2e83f55476ae96 26-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4d7e0ced7f16a04aabe2d8d91cbbb52fb1162810 25-Sep-2012 Alexander Kornienko <alexfh@google.com> Macro history (de-)serialization. Deserialization currently reads only the latest macro definition. Needs more work.

Summary: Passes all tests (+ the new one with code completion), but needs a thorough review in part related to modules.

Reviewers: doug.gregor

Reviewed By: alexfh

CC: cfe-commits, rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5931331d4b99c8c602fa3ab6c82b94adb7e5552f 19-Sep-2012 Benjamin Kramer <benny.kra@googlemail.com> ASTWriter: Tighten up assertions when emitting a declaration name.

clang has recently started to warn about the enum compares:
lib/Serialization/ASTWriter.cpp:2760:31: warning: comparison of literal 256 with expression of type
'clang::DeclarationName::NameKind' is always true [-Wtautological-constant-out-of-range-compare]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8da8a660128180a31479216111ff9b19b11c95b4 19-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Add the TypeSourceInfo for the lambda call operator to the lambda's
definition info; it needs to be there because the mangler needs to
access it before we're finished defining the lambda class.
PR12808.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8a64bb58c3b24d7d97895e435bbc0965c99bd3be 29-Aug-2012 Alexander Kornienko <alexfh@google.com> Keep history of macro definitions and #undefs

Summary:
Summary: Keep history of macro definitions and #undefs with corresponding source locations, so that we can later find out all macros active in a specified source location. We don't save the history in PCH (no need currently). Memory overhead is about sizeof(void*)*3*<number of macro definitions and #undefs>+<in-memory size of all #undef'd macros>

I've run a test on a file composed of 109 .h files from boost 1.49 on x86-64 linux.
Stats before this patch:
*** Preprocessor Stats:
73222 directives found:
19171 #define.
4345 #undef.
#include/#include_next/#import:
5233 source files entered.
27 max include stack depth
19210 #if/#ifndef/#ifdef.
2384 #else/#elif.
6891 #endif.
408 #pragma.
14466 #if/#ifndef#ifdef regions skipped
80023/451669/1270 obj/fn/builtin macros expanded, 85724 on the fast path.
127145 token paste (##) operations performed, 11008 on the fast path.

Preprocessor Memory: 5874615B total
BumpPtr: 4399104
Macro Expanded Tokens: 417768
Predefines Buffer: 8135
Macros: 1048576
#pragma push_macro Info: 0
Poison Reasons: 1024
Comment Handlers: 8

Stats with this patch:
...
Preprocessor Memory: 7541687B total
BumpPtr: 6066176
Macro Expanded Tokens: 417768
Predefines Buffer: 8135
Macros: 1048576
#pragma push_macro Info: 0
Poison Reasons: 1024
Comment Handlers: 8

In my test increase in memory usage is about 1.7Mb, which is ~28% of initial preprocessor's memory usage and about 0.8% of clang's total VMM allocation.

As for CPU overhead, it should only be noticeable when iterating over all macros, and should mostly consist of couple extra dereferences and one comparison per macro + skipping of #undef'd macros. It's less trivial to measure, though, as the preprocessor consumes a very small fraction of compilation time.


Reviewers: doug.gregor, klimek, rsmith, djasper

Reviewed By: doug.gregor

CC: cfe-commits, chandlerc

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
df5faf5e7ae6823d0af0b801c4ac26d47f2cee97 25-Aug-2012 Chad Rosier <mcrosier@apple.com> [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cd518a0ebc7c0a6aa41d717c360462540ef80a76 25-Aug-2012 Chad Rosier <mcrosier@apple.com> [ms-inline asm] Update the AST Reader/Writer for MS-style inline asms.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1ddbd89bb397988dd1a4e96d8d8c2c7705a2af75 24-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix a few -Wdocumentation warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9fbf327cfdd27ddb5d845042c95f2299ac95b143 15-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove trailing return flag from FunctionTypeLoc, since we now carry that
information on FunctionProtoType. (This also fixes one of *many* misalignment
problems in the TypeLoc hierarchy...)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b9d0b76e42fd2d4cdfd135220302458d03ad09fe 27-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4990890fc9428f98bef90ba349203a648c592778 09-Jul-2012 Alexander Kornienko <alexfh@google.com> Inline storage of attributes in AttributedStmt.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7518b3784ed2176aad8dcabe0685c6e02c5f1043 02-Jul-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Make sure that all newly introduced visible decls in a DeclContext
coming from an AST file are registered for serialization.

A static data member instantiation of in a chained PCH could be missed
when serializing decls; the result was that when emitting the visible decls
map of its DeclContext, we would use a DeclID that was not actually emitted,
leading to crashes or hangs.

Fix this by making sure such decls are always registered for serialization.
Also introduce extra sanity checks to make sure we don't register new
declarations or types after we have serialized the types/decls block.

rdar://11728990

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
260611a32535c851237926bfcf78869b13c07d5b 20-Jun-2012 John McCall <rjmccall@apple.com> Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend: break this
down into a single target runtime kind and version, and compute
all the relevant information from that. This makes it
relatively painless to add support for new runtimes to the
compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime. This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
d3861ce75a308c65b58c0159e2cee58aea2dff1c 10-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove CXXRecordDecl flags which are unused after r158289.

We need an efficient mechanism to determine whether a defaulted default
constructor is constexpr, in order to determine whether a class is a literal
type, so keep the incrementally-built form on CXXRecordDecl. Remove the
on-demand computation of same, so that we only have one method for determining
whether a default constructor is constexpr. This doesn't affect correctness,
since default constructor lookup is much simpler than selecting a constructor
for copying or moving.

We don't need a corresponding mechanism for defaulted copy or move constructors,
since they can't affect whether a type is a literal type. Conversely, checking
whether such functions are constexpr can require non-trivial effort, so we defer
such checks until the copy or move constructor is required.

Thus we now only compute whether a copy or move constructor is constexpr on
demand, and only compute whether a default constructor is constexpr in advance.
This is unfortunate, but seems like the best solution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
47d9de678162202786aa5f8aa153a7c58a4cebd4 08-Jun-2012 Douglas Gregor <dgregor@apple.com> Switch LineTableInfo to use FileID instead of int for file references,
from Tom Honermann!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
855243789cb44799c03f4c7216d3d6308805f549 07-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Plug a long standing memory leak in TemplateArgument.

The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
facde171ae4b8926622a1bffa833732a06f1875b 06-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Remove unused private member variables found by clang's new -Wunused-private-field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d079abfb5eefaf7da232e39a6564f561402cf4fe 07-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> A union can have a constexpr defaulted default constructor, if it has an
in-class initializer for one of its fields. Value-initialization of such
a type should use the in-class initializer!

The former was just a bug, the latter is a (reported) standard defect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7bb698aa054de4c0e0aa23973b2c62dac9611262 21-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix serialization of uninstantiated exception specifications. Patch by Li Kan,
test by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
eb382ec1507cf2c8c12d7443d0b67c076223aec6 19-Apr-2012 Patrick Beard <pcbeard@mac.com> Implements boxed expressions for Objective-C. <rdar://problem/10194391>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
534986f2b21e6050bf00163cd6423fd92155a6ed 14-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add an AttributedStmt type to represent a statement with C++11 attributes
attached. Since we do not support any attributes which appertain to a statement
(yet), testing of this is necessarily quite minimal.

Patch by Alexander Kornienko!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154723 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a8e0b978d63c52e39c002fbf014ce553374fedcf 26-Mar-2012 Douglas Gregor <dgregor@apple.com> Canonicalize the declaration we write to a PCH file for an
InjectedClassNameType; otherwise, it won't be properly wired to the
original (canonical) declaration when it is deserialized. Fixes
<rdar://problem/11112464>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153442 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c5d3e80c64af9604ad798282cc6861f9cd2afc52 16-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix Objective-C compilation-time performance regression introduced in r152608.

Reintroduce lazy name lookup table building, ensuring that the lazy building step
produces the same lookup table that would be built by the eager step.

Avoid building a lookup table for the translation unit outside C++, even in cases
where we can't recover the contents of the table from the declaration chain on
the translation unit, since we're not going to perform qualified lookup into it
anyway. Continue to support lazily building such lookup tables for now, though,
since ASTMerge uses them.

In my tests, this performs very similarly to ToT with r152608 backed out, for C,
Obj-C and C++, and does not suffer from PR10447.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
65daef179790a02eab1b5a989f53984375a06483 13-Mar-2012 Nick Lewycky <nicholas@mxc.ca> It never makes sense to do a lookup into a LinkageSpecDecl, so assert that we
don't, and clean up the places that do it.

The change to ASTWriter is surprising, but the deleted code is a no-op as of
r152608.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152609 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
f4b88a45902af1802a1cb42ba48b1c474474f228 10-Mar-2012 John McCall <rjmccall@apple.com> Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context. I'm amenable to suggestions about the exact meaning
of this bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
29f98b40caabca1ec820d546c5c08206a1d4f520 08-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Fix a crash when serializing a preprocessing record that contains
an #include entry that did not resolve to header file.

Part of rdar://11007039

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

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

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

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bef35c91b594f66216f4aab303b71a6c5ab7abcf 07-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Mark a PCH file with a flag to indicate if the serialized AST had
compiler errors or not.

-Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time.
By default, such a PCH file will be rejected with an error when trying to load it.

[libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors
occurred.
-Have libclang API calls accept a PCH that had compiler errors.

The general idea is that we want libclang to stay functional even if a PCH had a compiler error.
rdar://10976363.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
dfefb840e36f069286ef6cf178ef339c90f4603d 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes and
data members for deleted or user-provided destructors.

Now it's computed in advance, serialize it, and in passing fix all the other
record DefinitionData flags whose serialization was missing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
69015c22e1e3f96ff0e6e31965188e095297a744 24-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Change the text of a FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8cceefac395d476114b3d4ecd7e969b2e1c9271d 24-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When keeping track of top-level decls for "targeted deserialization"
make sure we don't mistake ParmVarDecls for top-level decls.

Fixes rdar://10920009.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f4b7de1cef3007cc0479775638198287384d9af1 21-Feb-2012 Douglas Gregor <dgregor@apple.com> Improve our handling of lambda expressions that occur within default
arguments. There are two aspects to this:

- Make sure that when marking the declarations referenced in a
default argument, we don't try to mark local variables, both because
it's a waste of time and because the semantics are wrong: we're not
in a place where we could capture these variables again even if it
did make sense.
- When a lambda expression occurs in a default argument of a
function template, make sure that the corresponding closure type is
considered dependent, so that it will get properly instantiated. The
second bit is a bit of a hack; to fix it properly, we may have to
rearchitect our handling of default arguments, parsing them only
after creating the function definition. However, I'd like to
separate that work from the lambdas work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
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
Sema.

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
/external/clang/lib/Serialization/ASTWriter.cpp
9d36f5dc4121f0f931211ea2d0a74d299eb82b23 14-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement AST (de-)serialization for lambda expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
variable.
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
/external/clang/lib/Serialization/ASTWriter.cpp
eefb3d5b49c844347f212073a7e975b8118fe8e9 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Track whether a function type has a trailing return type as type sugar. Use this
to pretty-print such function types better, and to fix a case where we were not
instantiating templates in lexical order. In passing, move the Variadic bit from
Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits.
Also ensure that we always substitute the return type of a function when
substituting explicitly-specified arguments, since that can cause us to bail
out with a SFINAE error before we hit a hard error in parameter substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
66581d41527628d4b37f7b05c288f77be7415d7d 06-Feb-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added source location for the template keyword in DependentTemplateSpecializationTypeLoc nodes (DTSTLoc).

The new info is propagated to TSTLoc on template instantiation, getting rid of 3 FIXMEs in TreeTransform.h and another one Parser.cpp.

Simplified code in TypeSpecLocFiller visitor methods for DTSTLoc and DependentNameTypeLoc by removing what now seems to be dead code (adding corresponding assertions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
38a42916cb07fd368d9e2ae1e7915fa896f9ec06 06-Feb-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Removed redundant location info from ElaboratedTypeLoc / DependentNameLoc / DependentTSTLoc. Uniformed names referencing elaborated keyword. No intended functionality changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
55d23c925b058be29b792008ddb7d68f6c4fa9a0 06-Feb-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added location for template keyword in TemplateSpecializationTypeLoc. In the process removed some naming ambiguities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f7ccbad5d9949e7ddd1cbef43d482553b811e026 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import SmallString<> into clang namespace

(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6f 27-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce module attributes into the module map grammar, along with a
single attribute ("system") that allows us to mark a module as being a
"system" module. Each of the headers that makes up a system module is
considered to be a system header, so that we (for example) suppress
warnings there.

If a module is being inferred for a framework, and that framework
directory is within a system frameworks directory, infer it as a
system framework.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cff9f26ce0ed76d555cd33b3dca84dd5cdf376af 27-Jan-2012 Douglas Gregor <dgregor@apple.com> Reimplement (de-)serialization of Objective-C categories to eliminate
the direct serialization of the linked-list structure. Instead, use a
scheme similar to how we handle redeclarations, with redeclaration
lists on the side. This addresses several issues:
- In cases involving mixing and matching of many categories across
many modules, the linked-list structure would not be consistent
across different modules, and categories would get lost.
- If a module is loaded after the class definition and its other
categories have already been loaded, we wouldn't see any categories
in the newly-loaded module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
56ca8a9c0fabd65418e9b2fd85140f4ed7d3c187 17-Jan-2012 Douglas Gregor <dgregor@apple.com> Rework the way in which we (de-)serialize the declarations
corresponding to TagType and ObjCInterfaceType. Previously, we would
serialize the definition (if available) or the canonical declaration
(if no definition was available). However, this can end up forcing the
deserialization of the definition even through we might not want to
yet.

Instead, always serialize the canonical declaration reference in the
TagType/ObjCInterfaceType entry, and as part of loading a pending
definition, update the "decl" pointer within the type node to point at
the definition. This is more robust in hard-to-isolate cases
where the *Type gets built and filled in before we see the definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
cc32b44ea4b3c702bf84eae0af27ca160bd90831 15-Jan-2012 Douglas Gregor <dgregor@apple.com> When deserializing the definition of a C++ class/ObjC class/ObjC
protocol, record the definition pointer in the canonical declaration
for that entity, and then propagate that definition pointer from the
canonical declaration to all other deserialized declarations. This
approach works well even when deserializing declarations that didn't
know about the original definition, which can occur with modules.

A nice bonus from this definition-deserialization approach is that we
no longer need update records when a definition is added, because the
redeclaration chains ensure that the if any declaration is loaded, the
definition will also get loaded.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2171bf1caba4d4b9eeb6a91efac4300b41f38b07 15-Jan-2012 Douglas Gregor <dgregor@apple.com> Completely re-implement (de-)serialization of redeclaration
chains, again. The prior implementation was very linked-list oriented, and
the list-splicing logic was both fairly convoluted (when loading from
multiple modules) and failed to preserve a reasonable ordering for the
redeclaration chains.

This new implementation uses a simpler strategy, where we store the
ordered redeclaration chains in an array-like structure (indexed based
on the first declaration), and use that ordering to add individual
deserialized declarations to the end of the existing chain. That way,
the chain mimics the ordering from its modules, and a bug somewhere is
far less likely to result in a broken linked list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1c7946a9fbba8671cc57f7dfd00721f8c035f913 05-Jan-2012 Douglas Gregor <dgregor@apple.com> Don't seed the ASTWriter's declaration -> ID mapping with the IDs of
each deserialized declaration, since that information is already
available in each declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6b60c1521a2e65f60e93c5fd56c103cf027df63 05-Jan-2012 Douglas Gregor <dgregor@apple.com> When we deserialize a declaration from a module file, allocate extra
storage for the global declaration ID. Declarations that are parsed
(rather than deserialized) are unaffected, so the number of
declarations that pay this cost tends to be relatively small (since
relatively few declarations are ever deserialized).

This replaces a largish DenseMap within the AST reader. It's not
strictly a win in terms of memory use---not every declaration was
added to that DenseMap in the first place---but it's cleaner to have
this information available for every deserialized declaration, so that
future clients can rely on it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147617 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b7a7819473709c01ea024a2dc15e99d38f0f8760 05-Jan-2012 Douglas Gregor <dgregor@apple.com> Store the submodules of a module in source order, as they are stored
in the module map. This provides a bit more predictability for the
user, as well as eliminating the need to sort the submodules when
serializing them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147564 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bd9482d859a74bf2c45ef8b8aedec61c0e1c8374 01-Jan-2012 Douglas Gregor <dgregor@apple.com> Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a6387f3b447015073192f1e1cafec3ebd0294c8c 01-Jan-2012 Douglas Gregor <dgregor@apple.com> Don't bother rewriting an Objective-C class or protocol declaration to the module file when we've merely added a definition

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147414 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3937f87e53b3ee0c8da93536f48f6f96c006309d 01-Jan-2012 Douglas Gregor <dgregor@apple.com> Eliminate ASTMutationListener::UpdatedAttributeList, which is no
longer needed now that we aren't back-patching ObjCProtocolDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1d784b277cdfd4eba03680715d2a082b3f28d295 01-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce the core infrastructure needed to model redeclaration chains
for Objective-C protocols, including:
- Using the first declaration as the canonical declaration
- Using the definition as the primary DeclContext
- Making sure that all declarations have a pointer to the definition
data, and that we know which declaration is the definition
- Serialization support for redeclaration chains and for adding
definitions to already-serialized declarations.

However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCProtocolDecls.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
51f564f80d9f71e175635b452ffeeeff899e9bf1 31-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows
mixed-language modules, where certain headers only work under some
language variants (e.g., in C++, std.tuple might only be available in
C++11 mode).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
375bb1413c041055262c8a416f20d10474a5eda9 27-Dec-2011 Douglas Gregor <dgregor@apple.com> Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c3cfd2ab3338d47861ece597212f21b972ebe727 22-Dec-2011 Douglas Gregor <dgregor@apple.com> Serialize the AST reader's mapping from canonical declarations to the
set of (previously-canonical) declaration IDs to the module file, so
that future AST reader instances that load the module know which
declarations are merged. This is important in the fairly tricky case
where a declaration of an entity, e.g.,

@class X;

occurs before the import of a module that also declares that
entity. We merge the declarations, and record the fact that the
declaration of X loaded from the module was merged into the (now
canonical) declaration of X that we parsed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1d4c1137c314cfb9ced32006cacdb80deffb66d4 20-Dec-2011 Douglas Gregor <dgregor@apple.com> When we make a previously-deserialized module definition visible,
notify the AST deserialization listener so that the AST writer knows
that it can write the macro definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
305dc3ebaa0bea5f3b789e4b54afc79c25907615 20-Dec-2011 Douglas Gregor <dgregor@apple.com> Detect when mapping a #include/#import over to a submodule ends up
hitting a submodule that was never actually created, e.g., because
that header wasn't parsed. In such cases, complain (because the
module's umbrella headers don't cover everything) and fall back to
including the header.

Later, we'll add a warning at module-build time to catch all such
cases. However, this fallback is important to eliminate assertions in
the ASTWriter when this happens.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a126651270acf17c434f60f86a3ab3687f87813a 19-Dec-2011 Douglas Gregor <dgregor@apple.com> Eliminate the first->last redeclaration map from the AST file
format. It's no longer being used, now that we have a new
implementation of redeclaration chains.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
925be547b163675b312e3cac0cc7f37f31d787c1 19-Dec-2011 Craig Topper <craig.topper@gmail.com> Begin adding AVX2 intrinsics. Necessitated increasing the number of bits used to store builtinID when serializing identifier table.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a1be278c4f3a234ff61f04018d26c6beecde1654 18-Dec-2011 Douglas Gregor <dgregor@apple.com> Completely re-implement (de-)serialization of declaration
chains. The previous implementation relied heavily on the declaration
chain being stored as a (circular) linked list on disk, as it is in
memory. However, when deserializing from multiple modules, the
different chains could get mixed up, leading to broken declaration chains.

The new solution keeps track of the first and last declarations in the
chain for each module file. When we load a declaration, we search all
of the module files for redeclarations of that declaration, then
splice together all of the lists into a coherent whole (along with any
redeclarations that were actually parsed).

As a drive-by fix, (de-)serialize the redeclaration chains of
TypedefNameDecls, which had somehow gotten missed previously. Add a
test of this serialization.

This new scheme creates a redeclaration table that is fairly large in
the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The
table is mmap'd in and searched via a binary search, but it's still
quite large. A future tweak will eliminate entries for declarations
that have no redeclarations anywhere, and should
drastically reduce the size of this table.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
53df7a1d34f21d8f2309311d1067d463e9064c60 15-Dec-2011 Douglas Gregor <dgregor@apple.com> Introduce the core infrastructure needed to model a complete
redeclaration chain for Objective-C classes, including:
- Using the first declaration as the canonical declaration.
- Using the definition as the primary DeclContext
- Making sure that all declarations have a pointer to the definition
data, and the definition knows that it is the definition.
- Serialization support for when a definition gets added to a
declaration that comes from an AST file.

However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCInterfaceDecls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bab9f4afaeb99319ac3567239d41cc1be3fb7e8c 13-Dec-2011 Douglas Gregor <dgregor@apple.com> Tweak submodule ID handling in the AST writer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146445 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
77d029f6a24dbf70d97e61757945df53fb250ea0 08-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement umbrella directories for modules, which are similar to
umbrella headers in the sense that all of the headers within that
directory (and eventually its subdirectories) are considered to be
part of the module with that umbrella directory. However, unlike
umbrella headers, which are expected to include all of the headers
within their subdirectories, Clang will automatically include all of
the headers it finds in the named subdirectory.

The intent here is to allow a module map to trivially turn a
subdirectory into a module, where the module's structure can mimic the
directory structure.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
10694cee2588442bee1e717f5042c58ffee25279 08-Dec-2011 Douglas Gregor <dgregor@apple.com> Within the module representation, generalize the notion of an umbrella
header to also support umbrella directories. The umbrella directory
for an umbrella header is the directory in which the umbrella header
resides.

No functionality change yet, but it's coming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e209e5026892cb07294f733c72bd51359c0f0e72 06-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement inferred submodules support, which (when requested)
implicitly generates submodules corresponding to the headers that fall
within a module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1e12368db12005ddd92fd9188c86383fe30ef443 05-Dec-2011 Douglas Gregor <dgregor@apple.com> Parse inferred submodules in module maps, track their contents in
Module, and (de-)serialize this information. Semantics of inferred
submodules to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0adaa880993ad23186c87c7f98e7a3fd2697742c 05-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for wildcard exports in modules, allowing a module
to re-export anything that it imports. This opt-in feature makes a
module behave more like a header, because it can be used to re-export
the transitive closure of a (sub)module's dependencies.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4bc8738d837e5d401235f99e55277338e20e3651 05-Dec-2011 Douglas Gregor <dgregor@apple.com> Actually add a useful bit to the comment pre-FIXME

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
55988680ece66b8e505ee136b35e74fcb1173aee 05-Dec-2011 Douglas Gregor <dgregor@apple.com> When writing a module file, keep track of the set of (sub)modules that
it imports, establishing dependencies at the (sub)module
granularity. This is not a user-visible change (yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c5e0f9b44782204437de21594c1748b1405d90bc 03-Dec-2011 Douglas Gregor <dgregor@apple.com> Module files representing actual modules don't need to know the set of modules they import, since that information isn't actually used. Drop it from the AST file



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f6137e4d15cb6bbd10547267babfc699c1945873 03-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for precompiled headers, preambles, and serialized
"main" files that import modules. When loading any of these kinds of
AST files, we make the modules that were imported visible into the
translation unit that loaded the PCH file or preamble.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
af13bfc3b40aa4a46f4e71d200ecfb10f45297fc 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement (de-)serialization of the set of exported modules in a
module map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a015cab273705d1198d13e8389c2f4775f539a8b 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Notify the AST writer (via ASTDeserializationListener) when a
(sub)module is read from an AST file. This makes sure that the AST
writer knows how to map all modules to their global IDs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145685 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1329264ce0922b3cec8c8c599108f082105fa0e1 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement name hiding for macro definitions within modules, such that
only the macro definitions from visible (sub)modules will actually be
visible. This provides the same behavior for macros that r145640
provided for declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ecc2c090e7146c029dd9ee9a5a2fd66b275c01c0 01-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement name hiding for declarations deserialized from a non-visible
module. When that module becomes visible, so do those declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
185dbd7782a45d0f830218bfbc196c6b664ed8d9 01-Dec-2011 Douglas Gregor <dgregor@apple.com> Infer the submodule ID for a given declaration based on the location
of that declaration, and encode the submodule ID in each declaration
stored in an AST file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145555 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
26ced127b7d443fcf3472463c9f39c2376bd9d70 01-Dec-2011 Douglas Gregor <dgregor@apple.com> Switch the ID numbers used for submodule IDs in the AST reader over to
a standard global/local scheme, so that submodule definitions will
eventually be able to refer to submodules in other top-level
modules. We'll need this functionality soonish.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1a4761edca58c6b559de825b9abfb66f7f1ba94a 01-Dec-2011 Douglas Gregor <dgregor@apple.com> Promote ModuleMap::Module to a namespace-scope class in the Basic
library, since modules cut across all of the libraries. Rename
serialization::Module to serialization::ModuleFile to side-step the
annoying naming conflict. Prune a bunch of ModuleMap.h includes that
are no longer needed (most files only needed the Module type).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
392ed2b717d86ebdd202cb9bb58d18d8b3b4cd87 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Implement (de-)serialization of the description of a module and its
submodules. This information will eventually be used for name hiding
when dealing with submodules. For now, we only use it to ensure that
the module "key" returned when loading a module will always be a
module (rather than occasionally being a FileEntry).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a8cc6ce36e70e2afa22ab6b4340035cb3941c2eb 30-Nov-2011 Douglas Gregor <dgregor@apple.com> When writing a module file, pass the module through to the AST
writer. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a081da5e44600d02983d6562bed1b4fd61e410fd 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Implement (de-)serialization of the buffer contents for an overridden
file in the source manager. This allows us to properly create and use
modules described by module map files without umbrella headers (or
with incompletely umbrella headers). More generally, we can actually
build a PCH file that makes use of file -> buffer remappings, which
could be useful in libclang in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b86b8dc7ef89405205f94635c1073cdb1a7093eb 15-Nov-2011 Douglas Gregor <dgregor@apple.com> Add a -cc1-level option -fmodule-name=<name>, which will be used when
building modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c80553efdc269dabd4ed0c3210555f45729ab5dd 14-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Do not crash if a class extension in a chained PCH introduces/redeclares a property.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
67bc4ba9894506c461aeff11302c2d2471b82273 14-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] In ASTWriter::WriteChainedObjCCategories use getDeclID since the decls
should have been already emitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
590ad93bf59f4e5f6adcba0d78efc3a58cac15ce 13-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When chaining a PCH and serializing HeaderSearch, make sure the HeaderFileInfos
from the primary PCH is deserialized, otherwise we lose info that headers were
already #imported/#included.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
1a43415b28e60e0e421ef60e254126acec7ab462 12-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a method in ASTMutationListener for the last use of Decl's [is/set]ChangedSinceDeserialization
and remove them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ad834d534e9a5db3d3baa09593775f83ceaff1f2 12-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When completing an objc forward reference, do not serialize the chain of its categories because
it is going to be rewritten (and the chain will be serialized again), otherwise we may form a cycle in its
categories list when deserializing.

Also introduce ASTMutationListener::CompletedObjCForwardRef to notify that a forward reference
was completed; using Decl's isChangedSinceDeserialization/setChangedSinceDeserialization
is bug inducing and kinda gross, we should phase it out.

Fixes infinite loop in rdar://10418538.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
76852c218a207ef43583515cb835b6e855353a0f 01-Nov-2011 Douglas Gregor <dgregor@apple.com> Rework the AST for the initializer of a delegating constructor, so
that it retains source location information for the type. Aside from
general goodness (being able to walk the types described in that
information), we now have a proper representation for dependent
delegating constructors. Fixes PR10457 (for real).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ef23b6001e8d9715246ca23bd8c3a6887d7844cb 31-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Now that we store the location of a decl outside its record
make sure that we keep track of locations of replaced decls as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143341 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
fab8d5b478e6fb112b4414c4698a7cc2a350b0f0 29-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Sort the file decls by file offset not raw source location.

Currently sorting by raw source location does work as intended but who knows
what may change in the future..

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
19645d2ae928580b62f9feff91c5aa5e19f5f20d 29-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] In ASTWriter::associateDeclWithFile don't bother finding the file loc
if we are not interested in the decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143255 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
10f3df54486385e6497c9e5f229ff816e5a6c511 29-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Keep track of file-level declarations that are contained by files.

Introduce a FILE_SORTED_DECLS [de]serialization record that contains
a file sorted array of file-level DeclIDs in a PCH/Module.
The rationale is to allow "targeted" deserialization of decls inside
a range of a source file.

Cocoa PCH increased by 0.8%
Difference of creation time for Cocoa PCH is below the noise level.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
eee242ff426bf79149f221798966e58688383c1e 27-Oct-2011 Douglas Gregor <dgregor@apple.com> Make the loading of information attached to an IdentifierInfo from an
AST file more lazy, so that we don't eagerly load that information for
all known identifiers each time a new AST file is loaded. The eager
reloading made some sense in the context of precompiled headers, since
very few identifiers were defined before PCH load time. With modules,
however, a huge amount of code can get parsed before we see an
@import, so laziness becomes important here.

The approach taken to make this information lazy is fairly simple:
when we load a new AST file, we mark all of the existing identifiers
as being out-of-date. Whenever we want to access information that may
come from an AST (e.g., whether the identifier has a macro definition,
or what top-level declarations have that name), we check the
out-of-date bit and, if it's set, ask the AST reader to update the
IdentifierInfo from the AST files. The update is a merge, and we now
take care to merge declarations before/after imports with declarations
from multiple imports.

The results of this optimization are fairly dramatic. On a small
application that brings in 14 non-trivial modules, this takes modules
from being > 3x slower than a "perfect" PCH file down to 30% slower
for a full rebuild. A partial rebuild (where the PCH file or modules
can be re-used) is down to 7% slower. Making the PCH file just a
little imperfect (e.g., adding two smallish modules used by a bunch of
.m files that aren't in the PCH file) tips the scales in favor of the
modules approach, with 24% faster partial rebuilds.

This is just a first step; the lazy scheme could possibly be improved
by adding versioning, so we don't search into modules we already
searched. Moreover, we'll need similar lazy schemes for all of the
other lookup data structures, such as DeclContexts.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
aa93a875605536d72a10359a0098396192b7d4ec 17-Oct-2011 Douglas Gregor <dgregor@apple.com> For modules, all macros that aren't include guards are implicitly
public. Add a __private_macro__ directive to hide a macro, similar to
the __module_private__ declaration specifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5e1cdac63c3d9c9b32fa41fa0b2d242a58a20d49 07-Oct-2011 John McCall <rjmccall@apple.com> Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
ba494c64365d78b1cdb6baea4d1e79263389fda9 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.
- Also, spell const_iterator as const_iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b1c99c679adb53be8f478d08be83af6c9c22ae4b 29-Sep-2011 Daniel Dunbar <daniel@zuster.org> Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
storing mappings with that instead of straying some magic constants about the
source.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8f958f14eadb9ae2019bcca6ecd6ad7520cde5ea 21-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Don't store the source range for each preprocessed entity since
we already have the range in the PPEntityOffsets array.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140209 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
290ad8c8eb1546692b20c4095ee441023f2f1005 21-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntity
and don't store the ID for each preprocessed entity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
de4e0a8e57e643bbe78ad37ad6023c45a8a9f7e2 21-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> The location of the name in MacroDefinition is the beginning of its range,
don't store an extra location for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
92ddef1bf843e1e18c040d69f48a6bf0bc7c776a 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange.

Also remove all the stuff that were added in ASTUnit that are unnecessary now
that we do a binary search for preprocessed entities and deserialize only
what is necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6441ef9b7285bd1aa77b05b10f473f7a3f413e7 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2dbaca748bc3eb6539f417bd8354c930bdf88fa4 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()
which will do a binary search and return a pair of iterators
for preprocessed entities in the given source range.

Source ranges of preprocessed entities are stored twice currently in
the PCH/Module file but this will be fixed in a subsequent commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
61c5e340c26971d195bd27232e7f2e71be24bb52 17-Sep-2011 Douglas Gregor <dgregor@apple.com> With modules, we can end up loading a new module after we've seen an
arbitrary amount of code. This forces us to stage the AST writer more
strictly, ensuring that we don't assign a declaration ID to a
declaration until after we're certain that no more modules will get
loaded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e24692b30adbe8144597678a0e3354912e99c747 15-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Overhaul how preprocessed entities are [de]serialized.

-Use an array of offsets for all preprocessed entities
-Get rid of the separate array of offsets for just macro definitions;
for references to macro definitions use an index inside the preprocessed
entities array.
-Deserialize each preprocessed entity lazily, at first request; not in bulk.

Paves the way for binary searching of preprocessed entities that will offer
efficiency and will simplify things on the libclang side a lot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ce835df9301d5bee7fc2c70344e05541f21a5dda 15-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't try to write a macro offset for an identifier that names a non-exported macro, for real this time

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5ed6277d2e8f621ff1edb09897a23682fc034d6e 14-Sep-2011 Douglas Gregor <dgregor@apple.com> Revert my exported-macro hackery. Something is amiss

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ec42f5d407dc344ba5a1c0c4730d8854a455cc45 14-Sep-2011 Douglas Gregor <dgregor@apple.com> Make sure that we actually keep the key length and data length in sync when dealing with non-exported macros

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0c129afcfb7860b9e1ff29c34edeab17b770140b 14-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't try to write a macro offset for an identifier that names a non-exported macro

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139728 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7d5e81bf24dbfd334a7c62a7ae51043c79a69aa9 13-Sep-2011 Douglas Gregor <dgregor@apple.com> Switch the serialization of LangOptions over to use the .def file. We
should no longer have the serialization of LangOptions out of sync
with the structure itself (yay).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e289d81369914678db386f6aa86faf8f178e245d 13-Sep-2011 Douglas Gregor <dgregor@apple.com> Switch LangOptions over to a .def file that describes header of the
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.

AST serialization changes are next up.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
768d6cae40ad4ff3aed5483269d068ff7a45e229 13-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Keep the source range of attributes. Depends on a llvm tablegen commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
530b14ad2717c48611c821805e787b5dbbf088ec 10-Sep-2011 Douglas Gregor <dgregor@apple.com> Eliminate all but one caller of Decl::getPCHLevel()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
919814def90acecd25a35445862f0c0ff72a9b05 10-Sep-2011 Douglas Gregor <dgregor@apple.com> Introduce a new predicate Decl::isFromASTFile() to determine whether a
declaration was deserialized from an AST file. Use this instead of
Decl::getPCHLevel() wherever possible. This is a simple step toward
killing off Decl::getPCHLevel().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8f7c540ac42370c40ebcdc4b69018c938faf94ec 08-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Fix annotation and getting a "macro expansion" cursor
for a builtin macro expansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
<rdar://problem/9267640>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
58e9797d001b34d03de6178eb91e9846fb90b79a 06-Sep-2011 Douglas Gregor <dgregor@apple.com> Finish implementing (de-)serialization of the CXXDefinitionData bits
needed for implicit move constructors and move assignment
operators. Fixes PR10847.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
7143aab97c6e849a5a5005b7853b8c7d5af008ed 01-Sep-2011 Douglas Gregor <dgregor@apple.com> Modules hide macro definitions by default, so that silly things like
include guards don't show up as macro definitions in every translation
unit that imports a module. Macro definitions can, however, be
exported with the intentionally-ugly #__export_macro__
directive. Implement this feature by not even bothering to serialize
non-exported macros to a module, because clients of that module need
not (should not) know that these macros even exist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e6b8d68a927368b06ac06cc9ac9e7f60aa966d5f 01-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support importing of ObjC categories from modules.

The initial incentive was to fix a crash when PCH chaining categories
to an interface, but the fix was done in the "modules way" that I hear
is popular with the kids these days.

Each module stores the local chain of categories and we combine them
when the interface is loaded. We also warn if non-dependent modules
introduce duplicate named categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
14c3633a0b6a06dd61c0cd239925174fc5728fff 31-Aug-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Serialize the new bits in CXXRecordDecl::DefinitionData.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e5a54b600f74dcb6cca27543df2757115711d80a 30-Aug-2011 Douglas Gregor <dgregor@apple.com> When writing out the entries in a lookup table for a DeclContext, make
sure that all of the CXXConversionDecls go into the same
bucket. Otherwise, name lookup might not find them all. Fixes
<rdar://problem/10041960>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
45118d8f2b50a37472dd03cd1d5b4abd7ae9f25b 30-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In ASTWriter::WriteDeclContextVisibleBlock, don't write empty lookups.

Empty lookups can occur in the DeclContext map when we are chaining PCHs, where
the empty lookup indicates that we already looked in ExternalASTSource.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138816 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3b84ab9f2adff42dcae3509c854a446b95917a10 30-Aug-2011 Jordy Rose <jediknil@belkadan.com> Remove obsolete ObjCInferRelatedReturnType from LangOptions...the correct option is ObjCInferRelatedResultType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c266de97e269c3747ffc2d122fe53185b541cb37 24-Aug-2011 Douglas Gregor <dgregor@apple.com> Don't force the complete deserialization of the visible-declarations
table when serializing an AST file. This was a holdover from the days
before chained PCH, and is a complete waste of time and storage
now. It's a good thing it's useless, because I have no idea how I
would have implemented MaterializeVisibleDecls efficiently in the
presence of modules.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d9d2b679d0728ea7f539f38aaea38e26b8b08043 22-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Boost the efficiency of SourceManager::getMacroArgExpandedLocation.

Currently getMacroArgExpandedLocation is very inefficient and for the case
of a location pointing at the main file it will end up checking almost all of
the SLocEntries. Make it faster:

-Use a map of macro argument chunks to their expanded source location. The map
is for a single source file, it's stored in the file's ContentCache and lazily
computed, like the source lines cache.
-In SLocEntry's FileInfo add an 'unsigned NumCreatedFIDs' field that keeps track
of the number of FileIDs (files and macros) that were created during preprocessing
of that particular file SLocEntry. This is useful when computing the macro argument
map in skipping included files while scanning for macro arg FileIDs that lexed from
a specific source file. Due to padding, the new field does not increase the size
of SLocEntry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
10bc00fd45824f9b5cd139d63af8b0f6d28aadda 18-Aug-2011 Douglas Gregor <dgregor@apple.com> Keep track of which modules have been loaded directly (e.g., via
-import-module) vs. loaded because some other module depends on
them. As part of doing this, pass down the module that caused a module
to be loaded directly, rather than assuming that we're loading a
chain. Finally, write out all of the directly-loaded modules when
serializing an AST file (using the new IMPORTS record), so that an AST
file can depend on more than one other AST file, all of which will be
loaded when that AST file is loaded. This allows us to form and load a
tree of modules, but we can't yet load a DAG of modules.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e95b9198b8b70ce0219cfb89483b41102e02dbf5 17-Aug-2011 Douglas Gregor <dgregor@apple.com> In the AST file format, eliminate the CHAINED_METADATA record. Instead,
all AST files have a normal METADATA record that has the same form
regardless of whether we refer to a chained PCH or any other kind of
AST file.

Introduce the IMPORTS record, which describes all of the AST files
that are imported by this AST file, and how (as a module, a PCH file,
etc.). Currently, we emit at most one entry to this record, to support
chained PCH.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d21683cdc0ff4217bfd98a9d8d0c1083b642caac 17-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When writing out ExpansionInfo, make sure we don't lose track if it's a macro arg expansion or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
requested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
b7c324f8581a55e2a918e5f3eb2e7418b09df0f2 12-Aug-2011 Douglas Gregor <dgregor@apple.com> Collapse ASTWriter::WriteASTChain into ASTWriter::WriteASTCore,
eliminating a pile of redundant code (and probably some bugs in the
process). The variation between chained and non-chained PCH is fairly
small now anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6bf2b9fbd3e3adc38d4712de79aeaa81d651aa08 12-Aug-2011 Douglas Gregor <dgregor@apple.com> In the serialized AST format, make the translation unit a "predefined"
declaration that never actually gets serialized. Instead, serialize
the various kinds of update records (lexical decls, visible decls, the
addition of an anonymous namespace) for the translation unit, even if
we're not chaining. This way, we won't have to deal with multiple
loaded translation unit declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
30403a611d6648099e7ad43ab82e3ba8e62bf00e 12-Aug-2011 Douglas Gregor <dgregor@apple.com> The AST reader and writer don't need accessors for poking at the predefined Objective-C types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6b8bc0707f26aa6acfdd80a59b9a3850cafbe387 10-Aug-2011 Richard Smith <richard-llvm@metafoo.co.uk> Renamings to consistently use 'Constexpr' not 'ConstExpr' when referring to the C++0x 'constexpr' keyword.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
3b8043b49aff6e5d70f29ef5684214ce2473763c 09-Aug-2011 Douglas Gregor <dgregor@apple.com> Migrate the serialization of ASTContext's AutoDeduceTy and
AutoRRefDeductTy from the "special types" block to predefined
types. The latter behaves better when loading multiple AST files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
272b6bc6a6c8fc04f951ad850df68c44d137f513 04-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce local -> global mapping for preprocessed entity IDs. This is
the last of the ID/offset/index mappings that I know
of. Unfortunately, the "gap" method of testing doesn't work here due
to the way the preprocessing record performs iteration. We'll do more
testing once multi-AST loading is possible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7338a922dd1164002922163200b18a2c24eb0209 04-Aug-2011 Douglas Gregor <dgregor@apple.com> In the AST reader and writer, slide the preprocessed entity IDs by +1
so that we use ID zero as a sentinel for "no result". This matches the
convention set by all of the other global IDs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
837593fec8389eea3143920d7f2180b079b609e8 04-Aug-2011 Douglas Gregor <dgregor@apple.com> Add some missing record names to the AST output. No functionality change, but llvm-bcanalyzer will be a little more informative now for AST files

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
fb2d9e092f19cfcdd11ebd5ceac40456c090c7db 04-Aug-2011 Douglas Gregor <dgregor@apple.com> Implement the local -> global remapping for macro definition IDs in
the detailed preprocessing record. Tested with the standard "gaps" method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e92b8a1dbba150e213c4980710fcb59ec5c5c570 04-Aug-2011 Douglas Gregor <dgregor@apple.com> Don't introduce a local -> global mapping for CXXBaseSpecifiers. The
IDs will never cross module boundaries, since they're tied to the
CXXDefinitionData, so just use a local mapping throughout. Eliminate
the global -> local tables and supporting data.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b18b1fd33f958264630fbae2602c81275bae8c9a 04-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce local -> global selector ID mapping into the AST
reader. Tested with the usual "gaps" method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6ec60e00eeaaed78d98c85ce962d6f328094ca14 03-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce a local-to-global remapping for identifiers in the AST
reader, and fix up the one (!) place where we were improperly mapping
a local ID to a global ID. Tested via the usual "gaps" trick.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136817 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0a14e4bf604a91b035a479235adf4c2f6c9128a2 03-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce a constant for the number of predefined declarations in an
AST file, along with an enumeration naming those predefined
declarations. No functionality change, but this will make it easier to
introduce new predefined declarations, when/if we need them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
496c709a6f08f5c502b6f592ddd9ed40f953a5e5 03-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce the local -> global declaration ID mapping into the AST
reader, to allow AST files to be loaded with their declarations
remapped to different ID numbers. Fix a number of places where we were
either failing to map local declaration IDs into global declaration
IDs or where interpreting the local declaration IDs within the wrong
module.

I've tested this via the usual "random gaps" method. It works well
except for the preamble tests, because our handling of the precompiled
preamble requires declaration and preprocessed entity to be stable
when parsing code and then loading that back into memory. This
property will hold in general, but my randomized testing naturally
breaks this property to get more coverage. In the future, I expect
that the precompiled preamble logic won't need this property.

I am very unhappy with the current handling of the translation unit,
which is a rather egregious hack. We're going to have to do something
very different here for loading multiple AST files, because we don't
want to have to cope with merging two translation units. Likely, we'll
just handle translation units entirely via "update" records, and
predefine a single, fixed declaration ID for the translation
unit. That will come later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
e36050111e2bdb7efc014af9dd7f0009b492ac36 02-Aug-2011 Douglas Gregor <dgregor@apple.com> Change the hashing function for DeclContext lookup within an AST file
by eliminating the type ID from constructor, destructor, and
conversion function names. There are several reasons for this change:
- A given type (say, int*) isn't guaranteed to have a single, unique
type ID within a chain of PCH files. Hence, we could end up hashing
based on the wrong type ID, causing name lookup to fail.

- The mapping from types back to type IDs required one DenseMap
entry for every type that was ever deserialized, which was an
unacceptable cost to support just the name lookup of constructors,
destructors, and conversion functions. Plus, this mapping could
never actually work with chained or multiple PCH, based on the first
bullet.

Once we have eliminated the type from the hash function, these
problems go away, as does my horrible "reverse type remap" hack, which
was doomed from the start (see bullet #1 above) and far too
complicated.

However, note that removing the type from the hash function means that
all constructors, destructors, and conversion functions have the same
hash key, so I've updated the caller to double-check that the
declarations found have the appropriate name.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136708 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a119da0761cb6b85f53857eaee50f6ad8c5ea0a0 02-Aug-2011 Douglas Gregor <dgregor@apple.com> Implement a proper local -> global type ID remapping scheme in the AST
reader. This scheme permits an AST file to be loaded with its type IDs
shifted anywhere in the type ID space.

At present, the type indices are still allocated in the same boring
way they always have been, just by adding up the number of types in
each PCH file within the chain. However, I've done testing with this
patch by randomly sliding the base indices at load time, to ensure
that remapping is occurring as expected. I may eventually formalize
this in some testing flag, but loading multiple (non-chained) AST
files at once will eventually exercise the same code.

There is one known problem with this patch, which involves name lookup
of operator names (e.g., "x.operator int*()") in cases where multiple
PCH files in the chain. The hash function itself depends on having a
stable type ID, which doesn't happen with chained PCH and *certainly*
doesn't happen when sliding type IDs around. We'll need another
approach. I'll tackle that next.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f33740efdb2d836a96ba97ca3004d46404401439 02-Aug-2011 Douglas Gregor <dgregor@apple.com> Generalize the module offset map to include mapping information for
all of the kinds of IDs that can be offset. No effectively
functionality change; this is preparation for adding remapping for
IDs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136686 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
69a9e017855fe95bf96ff98101558d3dba4335d4 01-Aug-2011 Douglas Gregor <dgregor@apple.com> Move the serialization of the MODULE_OFFSET_MAP out of the source-manager-writing code and into the general chained-PCH writing code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5d51a1d22d862dfae44eaa098af4e09bbfebae72 01-Aug-2011 Douglas Gregor <dgregor@apple.com> Rename the AST file's SOURCE_LOCATION_MAP to MODULE_OFFSET_MAP, to indicate the greater role it will soon play in remapping.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
dfe6543e12eca5c79421378b7fa6b3e8fc403e63 28-Jul-2011 Douglas Gregor <dgregor@apple.com> Lazily deserialize Sema::VTableUses. Plus, fix the utterly and
completely broken deserialization mapping code we had for VTableUses,
which would have broken horribly as soon as our local-to-global ID
mapping became interesting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
31e37b2d7b4815fdea6a35d49f33005562f0d494 28-Jul-2011 Douglas Gregor <dgregor@apple.com> Make Sema::WeakUndeclaredIdentifiers lazily deserialized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ec12ce2f6da44bfc9048772327a3924498099d60 28-Jul-2011 Douglas Gregor <dgregor@apple.com> Make Sema::LocallyScopedExternalDecls lazily deserialized. In theory,
we could turn this into an on-disk hash table so we don't load the
whole thing the first time we need it. However, it tends to be very,
very small (i.e., empty) for most precompiled headers, so it isn't all
that interesting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b4dc485a2b38ea98ba7da01596fd0e8438120346 28-Jul-2011 Douglas Gregor <dgregor@apple.com> AST serialization support for the Framework in IndexHeaderMapHeader
fields of HeaderFileInfo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a126f17ca83b985300c1f65cee647bea108db657 28-Jul-2011 Douglas Gregor <dgregor@apple.com> Switch Sema::DynamicClasses over to LazyVector

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d58a0a55e64a7c410a80e9d6dcd899e61e99cc4d 28-Jul-2011 Douglas Gregor <dgregor@apple.com> Switch Sema::ExtVectorDecls over to LazyVector.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0129b561a1452bf057f6b18b6a1de815d487ab81 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Turn Sema::DelegatingCtorDecls into a LazyVector.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a2ee20aa9660851080135219cac5b31fbac08b78 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Switch Sema::UnusedFileScopedDecls over to a LazyVector.
- Added LazyVector::erase() to support this use case.
- Factored out the LazyDecl-of-Decls to RecordData translation in
the ASTWriter. There is still a pile of code duplication here to
eliminate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a862320972e63349524dc9aa744dec1b95f54ba1 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Introduce a new data structure, LazyVector, which is a vector whose
contents are lazily loaded on demand from an external source (e.g., an
ExternalASTSource or ExternalSemaSource). The "loaded" entities are
kept separate from the "local" entities, so that the two can grow
independently.

Switch Sema::TentativeDefinitions from a normal vector that is eagerly
populated by the ASTReader into one of these LazyVectors, making the
ASTReader a bit more like me (i.e., lazy).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
48d2c3f7c3ca48da05436afdc8426a245294ee65 26-Jul-2011 Jonathan D. Turner <jonathan.d.turner@gmail.com> This patch extends the previous patch by starting to incorporate more functionality, like lookup-by-name and exporting lookup tables, into the module manager. Methods now have documentation. A few more functions have been switched over to the new iterator style and away from manual/explicit iteration. Ultimately we want to move away from name lookup here, as symlinks make filenames not a safe unique value, but we use it here as a stopgap before better measures are in place (namely instead using FileEntry* from a global FileManager).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1728762d5a8cfaf8d64385f47b311e84de1ae7a2 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Migrate 'Instantiation' data and API bits of SLocEntry to 'Expansion'
etc. With this I think essentially all of the SourceManager APIs are
converted. Comments and random other bits of cleanup should be all thats
left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
78df836808aee22c3157e1bc23bc4ec569b80568 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Convert InstantiationInfo and much of the related code to ExpansionInfo
and various other 'expansion' based terms. I've tried to reformat where
appropriate and catch as many references in comments but I'm going to do
several more passes. Also I've tried to expand parameter names to be
more clear where appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
832d620b4ae0fc5fe28561b885b4cfc65cf5c9ab 22-Jul-2011 Douglas Gregor <dgregor@apple.com> Switch all of the "isysroot" const char*'s throughout the AST reader
and writer to StringRef or std::string, as appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
72a9ae18553bf8b6bdad84d2c54f73741a47e275 22-Jul-2011 Douglas Gregor <dgregor@apple.com> Rename ASTReader::PerFileData to serialization::Module, pulling it out
of ASTReader so it can become its own full-fledged class
(eventually). No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8f1231b70c2b1f6fe0cee097b447487b26810301 22-Jul-2011 Douglas Gregor <dgregor@apple.com> Introduce a global bit-offset continuous range map into the ASTReader,
so that we have one, simple way to map from global bit offsets to
local bit offsets. Eliminates a number of loops over the chain, and
generalizes for more interesting bit remappings.

Also, as an amusing oddity, we were computing global bit offsets
*backwards* for preprocessed entities (e.g., the directly included PCH
file in the chain would start at offset zero, rather than the original
PCH that occurs first in translation unit). Even more amusingly, it
made precompiled preambles work, because we were forgetting to adjust
the local bit offset to a global bit offset when storing preprocessed
entity offsets in the ASTUnit. Two wrongs made a right, and now
they're both right.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4c30bb148b53c8063e940ca3e049ba4d270dc9d5 21-Jul-2011 Douglas Gregor <dgregor@apple.com> Rework the detailed preprocessing record to separate preprocessing
entities generated directly by the preprocessor from those loaded from
the external source (e.g., the ASTReader). By separating these two
sets of entities into different vectors, we allow both to grow
independently, and eliminate the need for preallocating all of the
loaded preprocessing entities. This is similar to the way the recent
SourceManager refactoring treats FileIDs and the source location
address space.

As part of this, switch over to building a continuous range map to
track preprocessing entities.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135646 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f62d43d2afe1960755a1b5813cae1e5983bcac1b 19-Jul-2011 Douglas Gregor <dgregor@apple.com> Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f70d12dbd49fcc25f1dfc0127217112ae76bcb8f 15-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Move the Serialization library from 'instantiation' to 'expansion', with
the exception of its uses of SourceManager and SourceLocation APIs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1e5f83ba515157dc7f263dc91b1d51c7a5754c35 14-Jul-2011 Chris Lattner <sabre@nondot.org> StringMap::first() is about to start returning a StringRef, adapt.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9e5bb85ac899eeab7c21b5ff9030c3da6ff4837b 14-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Move the rest of the preprocessor terminology from 'instantiate' and
variants to 'expand'. This changed a couple of public APIs, including
one public type "MacroInstantiation" which is now "MacroExpansion". The
rest of the codebase was updated to reflect this, especially the
libclang code. Two of the C++ (and thus easily changed) libclang APIs
were updated as well because they pertained directly to the old
MacroInstantiation class.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
d8bba9c15230d2b1b3893e272106aa79efc50251 28-Jun-2011 Douglas Gregor <dgregor@apple.com> Add support for C++ namespace-aware typo correction, e.g., correcting

vector<int>

to

std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
74da19fc3a52d7e3005eeb7a7833859da84fd12a 15-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce a -cc1-level option to turn off related result type
inference, to be used (only) by the Objective-C rewriter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4c4efee6d3113f20b41efaeec08934332d2ea40e 13-Jun-2011 Douglas Gregor <dgregor@apple.com> Eliminate the -f[no]objc-infer-related-result-type flags; there's no
reason to allow the user to control these semantics through a flag.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
926df6cfabf3eaa4afc990c097fa4619b76a9b57 11-Jun-2011 Douglas Gregor <dgregor@apple.com> Implement Objective-C Related Result Type semantics.

Related result types apply Cocoa conventions to the type of message
sends and property accesses to Objective-C methods that are known to
always return objects whose type is the same as the type of the
receiving class (or a subclass thereof), such as +alloc and
-init. This tightens up static type safety for Objective-C, so that we
now diagnose mistakes like this:

t.m:4:10: warning: incompatible pointer types initializing 'NSSet *'
with an
expression of type 'NSArray *' [-Wincompatible-pointer-types]
NSSet *array = [[NSArray alloc] init];
^ ~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1:
note:
instance method 'init' is assumed to return an instance of its
receiver
type ('NSArray *')
- (id)init;
^

It also means that we get decent type inference when writing code in
Objective-C++0x:

auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil];
// ^ now infers NSMutableArray* rather than id




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
953c564288f2f376fed9c3540096bde3694bbb7a 04-Jun-2011 Jonathan D. Turner <jonathan.d.turner@gmail.com> Improvements to abbreviations for PCH which add support for EnumDecl, ObjCIvarDecl, TypedefDecl, VarDecl and FieldDecl and improve support for ParmVarDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a72d8c4556fbdfca2c9e101722812861fcbdde12 03-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce additional abbreviations into the AST writer for
DeclRefExprs, IntegerLiterals, and others, reducing Cocoa PCH size by
~1% and C++ header size by ~2.5%. From Jonathan Turner!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4cdb0e2a2e9d93805e5ceaf8bc7018bdd166aec1 02-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Store the offsets of source location file entries and go through them
in ASTReader::validateFileEntries().

This avoids going through all source location entries and fixes the performance regression.
Many thanks to Doug for the hint!
(rdar://9530587)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
2bb110125e0e5adb7c1c65d12adfa34151ca1c47 13-May-2011 Douglas Gregor <dgregor@apple.com> When determining whether we can make a declaration into a global
constant, also consider whether it's a class type that has any mutable
fields. If so, it can't be a global constant.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cdee3fee8ca4df7fb9179f29cc3ba96ac4fd0f95 12-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement implicit deletion of default constructors.

Yes, I'm aware that the diagnostics are awful.

Tests to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
37b8c9ee7cf2b4d5ce3ccd3be1fcadd18a783a57 09-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Clean up trivial default constructors now.

hasTrivialDefaultConstructor() really really means it now.

Also implement a fun standards bug regarding aggregates. Doug, if you'd
like, I can un-implement that bug if you think it is truly a defect.

The bug is that non-special-member constructors are never considered
user-provided, so the following is an aggregate:

struct foo {
foo(int);
};

It's kind of bad, but the solution isn't obvious - should

struct foo {
foo (int) = delete;
};

be an aggregate or not?

Lastly, add a missing initialization to FunctionDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131101 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
023df37c27ee8035664fb62f206ca58f4e2a169d 09-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" and
modify the semantics slightly to accomodate default constructors (I
hope).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
31d375f056447d4e2418275d4913661d3bfedb3e 06-May-2011 Douglas Gregor <dgregor@apple.com> Keep track of the file ID corresponding to the original file used to
build a precompiled header. Use this information to eliminate the call
to SourceManager::getLocation() while loading a precompiled preamble,
since SourceManager::getLocation() itself causes unwanted
deserialization.

Fixed <rdar://problem/9399352>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131021 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3e4c6c4c79a03f5cb0c4671d7c282d623c6dc35e 05-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for C++0x alias templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130953 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ebcbe1d3dc7d4f0c1f540a632fa0684dd0a857d5 05-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> there i fixed it

Increase robustness of the delegating constructor cycle detection
mechanism. No more infinite loops on invalid or logic errors leading to
false results. Ensure that this is maintained correctly accross
serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
156b640c67300f2b70eb11102aa393a610798cc6 04-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement serialization of delegating constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
dd3e5549e3c11e217078938aacf72f042eea5343 04-May-2011 Douglas Gregor <dgregor@apple.com> Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
which determines whether a particular file is actually a header that
is intended to be guarded from multiple inclusions within the same
translation unit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
name.

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
/external/clang/lib/Serialization/ASTWriter.cpp
ec997dc66627957bcdcd3db7906a68c1e14a279c 30-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Rename the last '[hH]asStandardLayout' entites to '[iI]sStandardLayout'
based on Doug's preferences when we discussed this in IRC. This brings
the wording more in line with the standard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a8225449421e8c1e996a7c48300521028946482a 30-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Completely re-implement the core logic behind the __is_standard_layout
type trait. The previous implementation suffered from several problems:

1) It implemented all of the logic in RecordType by walking over every
base and field in a CXXRecordDecl and validating the constraints of
the standard. This made for very straightforward code, but is
extremely inefficient. It also is conceptually wrong, the logic tied
to the C++ definition of standard-layout classes should be in
CXXRecordDecl, not RecordType.
2) To address the performance problems with #1, a cache bit was added to
CXXRecordDecl, and at the completion of every C++ class, the
RecordType was queried to determine if it was a standard layout
class, and that state was cached. Two things went very very wrong
with this. First, the caching version of the query *was never
called*. Even within the recursive steps of the walk over all fields
and bases the caching variant was not called, making each query
a full *recursive* walk. Second, despite the cache not being used, it
was computed for every class declared, even when the trait was never
used in the program. This probably significantly regressed compile
time performance for edge-case files.
3) An ASTContext was required merely to query the type trait because
querying it performed the actual computations.
4) The caching bit wasn't managed correctly (uninitialized).

The new implementation follows the system for all the other traits on
C++ classes by encoding all the state needed in the definition data and
building up the trait incrementally as each base and member are added to
the definition of the class.

The idiosyncracies of the specification of standard-layout classes
requires more state than I would like; currently 5 bits. I could
eliminate one of the bits easily at the expense of both clarity and
resilience of the code. I might be able to eliminate one of the other
bits by computing its state in terms of other state bits in the
definition. I've already done that in one place where there was a fairly
simple way to achieve it.

It's possible some of the bits could be moved out of the definition data
and into some other structure which isn't serialized if the serialized
bloat is a problem. That would preclude serialization of a partial class
declaration, but that's likely already precluded.

Comments on any of these issues welcome.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ab9c0386ee71d4df79a13919e403c52f36df58ce 29-Apr-2011 Anders Carlsson <andersca@mac.com> Serialize/deserialize the HasStandardLayout bit when writing/reading PCHs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f79a71908d6f28cb2bc0c081d9a801ed14d61d82 29-Apr-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Add a decl update when a static data member of a class template is instantiated in a different PCH than its containing class. Otherwise we get double definition errors. Fixes a Boost.MPL problem that affects Boost.Accumulators and probably a lot more of Boost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6e089c687cc2b914c46859ab7e46fe4c3c6b0afb 24-Apr-2011 Benjamin Kramer <benny.kra@googlemail.com> Use template magic to make dumping of vectors slightly less fragile.

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
58a2cd8c0d52e710cbcc57a67eac7b51b0b831c4 24-Apr-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Synthesizing the definition of an implicit member is an AST modification, so notify any mutation listeners of it. This fixes a crasher in chained PCH, where an implicit destructor in a PCH gets a definition in a chained PCH, which is then lost. However, any further use of the destructor would cause its definition to be regenerated in the final file, hiding the bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c1d3ffbbad742c90f22198d7909b0a98865bfefa 24-Apr-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Store the full list of pending instantiations in a chained PCH. Previously we attempted to store only new pending instantiations, but our filter was incorrect, dropping implicit instantiations of class template members. It's just not worth coming up with a complex filter that is correct, when the only cost is PCH files that are a few hundred bytes (at most) larger.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9b6347cd410be55425f7062d22fd6e4ecb4e1a58 24-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Implement most of the remaining logic in __is_literal type trait. This
should now support all of the C++98 types, and all of the C++0x types
Clang supports.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4d6e5a22d9481bb83b82d911727540096d171c0b 24-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Begin tracking trivialness of move constructors and move assignment
operators in C++ record declarations.

This patch starts off by updating a bunch of the standard citations to
refer to the draft 0x standard so that the semantics intended for move
varianst is clear. Where necessary these are duplicated so they'll be
available in doxygen.

It adds bit fields to keep track of the state for the move constructs,
and updates all the code necessary to track this state (I think) as
members are declared for a class. It also wires the state into the
various trait-like accessors in the AST's API, and tests that the type
trait expressions now behave correctly in the presence of move
constructors and move assignment operators.

This isn't complete yet due to these glaring FIXMEs:
1) No synthesis of implicit move constructors or assignment operators.
2) I don't think we correctly enforce the new logic for both copy and
move trivial checks: that the *selected* copy/move
constructor/operator is trivial. Currently this requires *all* of them
to be trivial.
3) Some of the trait logic needs to be folded into the fine-grained
trivial bits to more closely match the wording of the standard. For
example, many of the places we currently set a bit to track POD-ness
could be removed by querying other more fine grained traits on
demand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0d2d1bcef51993ca3fd957e45fb7ec85e45016e5 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Teach the AST reader and writer to preserve the __DEPRECATED bit in
language options, and warn when reading an AST with a different value
for the bit.

There doesn't appear to be a good way to test this (commenting out
similar other language options doesn't break anything) but if folks have
suggestions on tests I'm happy to add them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f111d935722ed488144600cea5ed03a6b5069e8f 15-Apr-2011 Peter Collingbourne <peter@pcc.me.uk> C1X: implement generic selections

As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7e7fbd05a5dfdb0addfc8b5af2fcbed8c7b5fb87 15-Apr-2011 Peter Collingbourne <peter@pcc.me.uk> C1X: add a language standard

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
5bbcdbf36f8cf79d99703ef20848c55960065e43 14-Apr-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Chained PCH: Remember when additional specializations are added to a function template from a previous PCH. Fixes the only crasher when using massive chains on Clang's Sema component. We still have some incomplete codegen there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
df1550fc59b51681d37225934fe4e3acac321621 12-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix AST serialization of reference-to-reference types. This previously caused
a crash when deserializing the AST for this:

typedef char (&R);
extern R &r;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a49218e17bcbb1acde0245773173e2c0c42f4f19 09-Apr-2011 Eli Friedman <eli.friedman@gmail.com> PR8369: make __attribute((regparm(0))) work correctly. Original patch by
pageexec@freemail.hu, tweaks by me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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()
__attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

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
/external/clang/lib/Serialization/ASTWriter.cpp
60618fa7f88d5162bb5b40988b6b38d4d75d6fc6 12-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
796aa443ab5ed036f42ef33fed629e1b4b34871b 12-Mar-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Forgotten part of previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2c10c8072cabeb22651462e435e8b81f3221b6a5 08-Mar-2011 Anders Carlsson <andersca@mac.com> When writing file references in a pch, make sure to ask the file manager for the absolute path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c850578dbfa68cf2d2776f59a5cb0009134d970e 06-Mar-2011 Anders Carlsson <andersca@mac.com> Write CXX base specifier offsets for chained ASTs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6ab6c1ca733fda2302a1c5066bdfc6218c89e41 05-Mar-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Improved MemberPointerType source locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b1c86492f9a9bef01a4567408c22f961bbd604fe 05-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Currently we can only remap a file by creating a MemoryBuffer and replacing the file contents with it.
Allow remapping a file by specifying another filename whose contents should be loaded if the original
file gets loaded. This allows to override files without having to create & load buffers in advance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6744efecba58792cce20d2d7b9ee39927c5422e 02-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into template
template arguments. I believe that this is the last place in the AST
where we were storing a source range for a nested-name-specifier
rather than a proper nested-name-specifier location structure. (Yay!)

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
94fdffa4a572fc14ac296f5f1aae9db3734c72f1 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source-location information into dependent
template specialization types. There are still a few rough edges to
clean up with some of the parser actions dropping
nested-name-specifiers too early.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9e876876afc13aa671cc11a17c19907c599b9ab9 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Reinstate the introduction of source-location information for
nested-name-speciciers within elaborated type names, e.g.,

enum clang::NestedNameSpecifier::SpecifierKind

Fixes in this iteration include:

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

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

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

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




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cfe9af250f466e7e38becea4428990448ae07737 01-Mar-2011 Roman Divacky <rdivacky@freebsd.org> Implement -mrtd which sets the StdCall calling convention to be the default
one.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2786864406af0f3ec65b300675c6f3c809c22fd7 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Revert r126748, my second attempt at nested-name-specifier source
location information for elaborated types. *sigh*


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
be38c5f5d8fa7c43c52fafddee054b8fe8c2b964 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.

The commit message from r126737:

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
44cd9f9d686dfdb9ad16113c41c2dca1da35a646 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
239cbb023c8da689e7722f7146914eed9755e368 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2494dd024b392b8def58bf067cc94b51c214cf77 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c22b5fff39a7520207f165fb16a27a34b944bd9c 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Use NestedNameSpecifierLoc within out-of-line variables, function, and
tag definitions. Also, add support for template instantiation of
NestedNameSpecifierLocs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
dc355713be51fcb4ee52d9fd6b4548ceff47fadf 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the
extremely-lossy NestedNameSpecifier/SourceRange pair it used to use,
improving source-location information.

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
14aba76042e041b2c5e439bf4ae353a0a3c7fd73 24-Feb-2011 Douglas Gregor <dgregor@apple.com> Teach NestedNameSpecifier to keep track of namespace aliases the same
way it keeps track of namespaces. Previously, we would map from the
namespace alias to its underlying namespace when building a
nested-name-specifier, losing source information in the process.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7da99b05aa9482e76b2954223b5652469004aec2 23-Feb-2011 Anders Carlsson <andersca@mac.com> Add a CXXExceptions flag to LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
da4b7cf09ebfd4e4098b516081fa9dae2f5c99e0 20-Feb-2011 Anders Carlsson <andersca@mac.com> Add a new ObjCExceptions member variable to LangOptions. This controls whether Objective-C exceptions are enabled or not (they are by default).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
84bccea1ad9fd8bc1f4ec3d1fc5dd8d15dabffbc 15-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> Serialization/deserialization support for floating point #pragma
options, enabled OpenCL extensions and default FP_CONTRACT setting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8e3df4d0864f0a966c20088ca1a29c3398b7639d 15-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow resolving headers from a PCH even after headers+PCH were moved to another path.

Store in PCH the directory that the PCH was originally created in.
If a header file is not found at the path that we expect it to be and the PCH file
was moved from its original location, try to resolve the file by assuming that
header+PCH were moved together and the header is in the same place relative to the PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125576 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
217cacc7f8542a3b87309f30ecfed69cbc4afe04 11-Feb-2011 Douglas Gregor <dgregor@apple.com> Eliminate a major performance problem with chained PCH, where we were
causing the deserialization of a large number of declarations when
writing the visible-updates record for the translation unit in C. This
takes us from:

*** AST File Statistics:
2 stat cache hits
6 stat cache misses
1/64463 source location entries read (0.001551%)
15606/16956 types read (92.038216%)
59266/89334 declarations read (66.342041%)
38952/61393 identifiers read (63.446976%)
0/7778 selectors read (0.000000%)
24192/34644 statements read (69.830276%)
388/8809 macros read (4.404586%)
2095/5189 lexical declcontexts read (40.373867%)
0/4587 visible declcontexts read (0.000000%)
0/7716 method pool entries read (0.000000%)
0 method pool misses

to

*** AST File Statistics:
2 stat cache hits
6 stat cache misses
1/64463 source location entries read (0.001551%)
26/16956 types read (0.153338%)
18/89334 declarations read (0.020149%)
145/61393 identifiers read (0.236183%)
0/7778 selectors read (0.000000%)
21/34644 statements read (0.060617%)
0/8809 macros read (0.000000%)
0/5189 lexical declcontexts read (0.000000%)
0/4587 visible declcontexts read (0.000000%)
0/7716 method pool entries read (0.000000%)
0 method pool misses

when generating a chained PCH for a header that #includes Cocoa.h
(from a PCH file) and adds one simple function declaration. The
generated PCH file is now only 9580 bytes (down from > 2MB).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
040a804f852c45c8b8c371ce1d421fd4cd84b6fb 11-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement AST/PCH chaining support for macro definitions. Previously,
we would deserialize all of the macro definitions we knew about while
serializing the macro definitions at the end of the AST/PCH file. Even
though we skipped most of them (since they were unchanged), it's still
a performance problem.

Now, we do the standard AST/PCH chaining trick: watch what identifiers
are deserialized as macro names, and consider only those identifiers
(along with macro definitions that have been deserialized/written in
the source) when serializing the preprocessor state.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
9c7361006b8cd95333958150dd0c803261807b68 10-Feb-2011 Douglas Gregor <dgregor@apple.com> When we're writing macro definitions to an AST/PCH File, sort the
macro definitions by macro name first. That way, we'll get a stable
ordering in the AST/PCH file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cfbf1c7536e016dc275139dd842d4a5f059a749f 10-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement two related optimizations that make de-serialization of
AST/PCH files more lazy:
- Don't preload all of the file source-location entries when reading
the AST file. Instead, load them lazily, when needed.
- Only look up header-search information (whether a header was already
#import'd, how many times it's been included, etc.) when it's needed
by the preprocessor, rather than pre-populating it.

Previously, we would pre-load all of the file source-location entries,
which also populated the header-search information structure. This was
a relatively minor performance issue, since we would end up stat()'ing
all of the headers stored within a AST/PCH file when the AST/PCH file
was loaded. In the normal PCH use case, the stat()s were cached, so
the cost--of preloading ~860 source-location entries in the Cocoa.h
case---was relatively low.

However, the recent optimization that replaced stat+open with
open+fstat turned this into a major problem, since the preloading of
source-location entries would now end up opening those files. Worse,
those files wouldn't be closed until the file manager was destroyed,
so just opening a Cocoa.h PCH file would hold on to ~860 file
descriptors, and it was easy to blow through the process's limit on
the number of open file descriptors.

By eliminating the preloading of these files, we neither open nor stat
the headers stored in the PCH/AST file until they're actually needed
for something. Concretely, we went from

*** HeaderSearch Stats:
835 files tracked.
364 #import/#pragma once files.
823 included exactly once.
6 max times a file is included.
3 #include/#include_next/#import.
0 #includes skipped due to the multi-include optimization.
1 framework lookups.
0 subframework lookups.

*** Source Manager Stats:
835 files mapped, 3 mem buffers mapped.
37460 SLocEntry's allocated, 11215575B of Sloc address space used.
62 bytes of files mapped, 0 files with line #'s computed.

with a trivial program that uses a chained PCH including a Cocoa PCH
to

*** HeaderSearch Stats:
4 files tracked.
1 #import/#pragma once files.
3 included exactly once.
2 max times a file is included.
3 #include/#include_next/#import.
0 #includes skipped due to the multi-include optimization.
1 framework lookups.
0 subframework lookups.

*** Source Manager Stats:
3 files mapped, 3 mem buffers mapped.
37460 SLocEntry's allocated, 11215575B of Sloc address space used.
62 bytes of files mapped, 0 files with line #'s computed.

for the same program.



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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125217 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
4800a5c79023271408af49797e09be32aca93232 08-Feb-2011 Douglas Gregor <dgregor@apple.com> Split the serialized representation for the detailed preprocessing
record away from the core processor record. The tangling of these two
data structures led to some inefficiencies (e.g., deserializing all
of the detailed preprocessing record when we didn't need it, such as
while performing code completion) along with some unnecessary
ugliness.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6c2b3f658df5525b9c0af606b64d304e7416c2f 08-Feb-2011 Douglas Gregor <dgregor@apple.com> Update the writing of the block-information block in the AST file
format, so that llvm-bcanalyzer knows about all of the various record
kinds.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f677ea3cc9598d9952ad7ffab5fb322ba4c5be31 05-Feb-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Basic implementation of inherited constructors. Only generates declarations, and probably only works for very basic use cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6f75550e40a9177db9979fc130ce3ece026b137d 01-Feb-2011 Douglas Gregor <dgregor@apple.com> Basic support for -mms-bitfields, from Carl Norum!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c938c1668b4fd12af154e965dd935a89e4801a70 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this:

- Add ref-qualifiers to the type system; they are part of the
canonical type. Print & profile ref-qualifiers
- Translate the ref-qualifier from the Declarator chunk for
functions to the function type.
- Diagnose mis-uses of ref-qualifiers w.r.t. static member
functions, free functions, constructors, destructors, etc.
- Add serialization and deserialization of ref-qualifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
cb88a1f968c3d4eb451dafb421a8d9578edcbf1a 24-Jan-2011 Anders Carlsson <andersca@mac.com> Use attributes for all the override control specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124122 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
faa6afd3e25688dc4e56c970ad57c0c31f2beeed 22-Jan-2011 Anders Carlsson <andersca@mac.com> Serialize and deserialize IsMarkedFinal/IsMarkedExplicit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a97d70b7ea9633e8cbf976510d7a9ea66f4ac96c 21-Jan-2011 Peter Collingbourne <peter@pcc.me.uk> Generalise support for non-inheritable attributes

Inheritable attributes on declarations may be inherited by any later
redeclaration at merge time. By contrast, a non-inheritable attribute
will not be inherited by later redeclarations. Non-inheritable
attributes may be semantically analysed early, allowing them to
influence the redeclaration/overloading process.

Before this change, the "overloadable" attribute received special
handling to be treated as non-inheritable, while all other attributes
were treated as inheritable. This patch generalises the concept,
while removing a FIXME. Some CUDA location attributes are also marked
as non-inheritable in order to support special overloading semantics
(to be introduced in a later patch).

The patch introduces a new Attr subclass, InheritableAttr, from
which all inheritable attributes derive. Non-inheritable attributes
simply derive from Attr.

N.B. I did not review every attribute to determine whether it should
be marked non-inheritable. This can be done later on an incremental
basis, as this change does not affect default functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
b1bdced5967c54d029cd12907e8939c78decf14c 15-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Store/retrieve -fshort-enums for PCH, fixes rdar://8854933.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2be29f423acad3bbe39099a78db2805acb5bdf17 15-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach template template argument pack expansions to keep track of the
number of expansions, when we know it, and propagate that information
through Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3efd52cf8f4e57c5571bd8cc3168264c3bc46a1e 14-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
mismatches.

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
/external/clang/lib/Serialization/ASTWriter.cpp
cbb67480094b3bcb5b715acd827cbad55e2a204c 08-Jan-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f84109ee6aeffb09366bd70c8593ce1b7818b1ad 07-Jan-2011 Fariborz Jahanian <fjahanian@apple.com> Update AST reader/writer to handle new AppleKext.
Fix an unexpected hickup caused by exceeding size of
generated table (and a misleading comment). Improve
on help message for -fapple-kext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
a7fc901a2e39bfe55bfcff5934b2d9fdf9656491 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Replace the representation of template template argument pack
expansions with something that is easier to use correctly: a new
template argment kind, rather than a bit on an existing kind. Update
all of the switch statements that deal with template arguments, fixing
a few latent bugs in the process. I"m happy with this representation,
now.

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ba68eca7582a62e3e2ff4b0eba1b2b73a6b80895 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Add semantic analysis for the creation of and an AST representation
for template template argument pack expansions. This allows fun such
as:

template<template<class> class ...> struct apply_impl { /*...*/ };
template<template<class> class ...Metafunctions> struct apply {
typedef typename apply_impl<Metafunctions...>::type type;
};

However, neither template argument deduction nor template
instantiation is implemented for template template argument packs, so
this functionality isn't useful yet.

I'll probably replace the encoding of template template
argument pack expansions in TemplateArgument so that it's harder to
accidentally forget about the expansion. However, this is a step in
the right general direction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f90b27ad077c3339b62befc892382845339f9490 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement pack expansions whose pattern is a base-specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c32647d111e516593b9ba242cad7b8ff4016c155 23-Dec-2010 Ted Kremenek <kremenek@apple.com> Add -fobjc-default-synthesized-properties flag
to allow us to explicitly control whether or
not Objective-C properties are default synthesized.
Currently this feature only works when using
the -fobjc-non-fragile-abi2 flag (so there is
no functionality change), but we can now turn
off this feature without turning off all the features
coupled with -fobjc-non-fragile-abi2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
fbfd180495e7800975c6d9bdc6d24e706ef70e34 21-Dec-2010 Michael J. Spencer <bigcheesegs@gmail.com> Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
0827408865e32789e0ec4b8113a302ccdc531423 15-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix diagnostic pragmas.

Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
f187237d916afa97c491ac32fe98be7d335c5b63 08-Dec-2010 Francois Pichet <pichet2000@gmail.com> Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
00eb3f9c5b33e3d99aee1f8b75dd9c9678fdd66b 04-Dec-2010 Francois Pichet <pichet2000@gmail.com> More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:

struct X {
X() : au_i1(123) {}
union {
int au_i1;
float au_f1;
};
};

clang will now deal with au_i1 explicitly as an IndirectFieldDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
08a53269b1f8241e2e6797e845abbe640fb18253 01-Dec-2010 Peter Collingbourne <peter@pcc.me.uk> Serialization: support for CUDA language extensions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
89d9980bbc2e4a4ac86673e6ec16fb9f5babb63b 30-Nov-2010 Douglas Gregor <dgregor@apple.com> When using a precompiled preamble with detailed preprocessing records,
trap the serialized preprocessing records (macro definitions, macro
instantiations, macro definitions) from the generation of the
precompiled preamble, then replay those when walking the list of
preprocessed entities. This eliminates a bug where clang_getCursor()
wasn't able to find preprocessed-entity cursors in the preamble.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
03013fa9a0bf1ef4b907f5fec006c8f4000fdd21 29-Nov-2010 Michael J. Spencer <bigcheesegs@gmail.com> Merge System into Support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
74e976ba4b0d407bb798ea26476f618e256fc8c7 23-Nov-2010 Chris Lattner <sabre@nondot.org> PCH files only cache successful stats. Remove the code that reads/writes
the result code of the stat to/from the PCH file since it is always 0.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
10e286aa8d39fb51a21412850265d9dae74613ee 23-Nov-2010 Chris Lattner <sabre@nondot.org> rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure. No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
910f8008fea79120489a53593fe971b0b8a4a740 08-Nov-2010 Douglas Gregor <dgregor@apple.com> Remove broken support for variadic templates, along with the various
abstractions (e.g., TemplateArgumentListBuilder) that were designed to
support variadic templates. Only a few remnants of variadic templates
remain, in the parser (parsing template type parameter packs), AST
(template type parameter pack bits and TemplateArgument::Pack), and
Sema; these are expected to be used in a future implementation of
variadic templates.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118385 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
60f7684881f9f6bc779e91212aea89d9afc723dd 05-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't write an empty DIAG_USER_MAPPINGS record.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118305 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f41d3be39980d40849850d3fb90403623cc8459e 05-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write from/to PCH the diagnostic mappings that the user set so that e.g. #pragma clang diagnostic can be used in a PCH.
Fixes rdar://8435969.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
acec34bda4a765fd05ed10e5aa83bc93dac072c1 30-Oct-2010 Douglas Gregor <dgregor@apple.com> Flush statements after writing each DECL_CXX_BASE_SPECIFIERS node

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7c789c1a3f77f24032aa0bed2afacdb9e094e952 30-Oct-2010 Douglas Gregor <dgregor@apple.com> Make the deserialization of C++ base class specifiers lazy, improving
the performance of C++ PCH and reducing stack depth in the reader.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
100050bf643bcfe2d06bdcef491e387171249260 28-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use the ASTMutationListener to track when a named decl gets added to a DeclContext,
meaning we need to rewrite its name lookup table in a chained PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0f04f69acd0a86ff78961933c13fe5aeda94e1b6 28-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Properly add chained template specializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
d3d0755a4220d3fa6c125eb3f8ce29fc1424eac3 28-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix the re-serializing decls in a chained PCH mechanism.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
bef1a7b9c175d37e4a727e6ce68bd05232fa6970 28-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use the ASTMutationListener to track added template specializations in a chained PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b6cc0e1a789c3f33e3f4b1ee768e679a9beab941 24-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Keep track in chained PCH of implicit members that were added after the definition was completed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
565bf30bf5607b9740d288d8d9c45cf38ea75298 24-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Start fleshing out ASTMutationListener; notify when a tag definition is completed.

In that case a chained PCH will record the updates to the DefinitionData pointer of forward references.
If a forward reference mutated into a definition re-write it into the chained PCH, this is too big of a change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ba901b507fc36408fe6f8478e8ac90b554f1d230 24-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls that will be replaced in the chained PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
aacdd02e5865aa410c1418d7ef77f445b5bb5cba 24-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Some method renaming, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
89eaf3af92c72c0c1aae807644e39cabc461d685 24-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactoring.
- Pass around RecordDataImpl instead of the concrete RecordData so that any SmallVector can be used.
- Move ASTDeclWriter::WriteCXXDefinitionData to ASTWriter::AddCXXDefinitionData.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
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
/external/clang/lib/Serialization/ASTWriter.cpp
dae4ac4fe56ec60fc93b3e3c9f51e79e682084b9 21-Oct-2010 Michael J. Spencer <bigcheesegs@gmail.com> Reorganize predefined macros for all Windows targets.

This adds an option to set the _MSC_VER macro without
recompiling. This is very useful when testing compatibility
with the Windows SDK and c++stdlib headers.

-fmsc-version=<version> (defaults to VS2003 (1300))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
20249a1af2e462dcafdd6a350f1c7967b264ff25 21-Oct-2010 Michael J. Spencer <bigcheesegs@gmail.com> Fix Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0ed 21-Oct-2010 Douglas Gregor <dgregor@apple.com> Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import,
etc. in the translation unit. We keep track of the source location and
kind of the inclusion, how the file name was spelled, and the
underlying file to which the inclusion resolved.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4eb9fc0449ddbd5239ddc3ae6b6e52880f47dcf7 18-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Read/write declaration attributes from/to PCH properly. Embed them in the declaration block instead of trying to create another block.

The new block was messing with the assumption that after decls block comes the stmts block.
Fixes http://llvm.org/PR8406

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
eb5e9986e577b1e2bff3cca5973a2494fb593fbb 14-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow deserialization of just the fields of a record, when we want to iterate over them,
instead of deserializing the complete declaration context of the record.

Iterating over the fields of a record is very common (e.g to determine the layout), unfortunately we needlessly deserialize every declaration
that the declaration context of the record contains; this can be bad for large C++ classes that contain a lot of methods.
Fix this by allow deserialization of just the fields when we want to iterate over them.
Progress for rdar://7260160.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8ac2d449820fd0df00fcbde5bf82165c1f49854d 14-Oct-2010 Fariborz Jahanian <fjahanian@apple.com> Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
97475834207bf5abb5b58534f783c9b71d4b9df1 05-Oct-2010 Douglas Gregor <dgregor@apple.com> Fix a marvelous chained AST writing bug, where we end up with the
following amusing sequence:
- AST writing schedules writing a type X* that it had never seen
before
- AST writing starts writing another declaration, ends up
deserializing X* from a prior AST file. Now we have two type IDs for
the same type!
- AST writer tries to write X*. It only has the lower-numbered ID
from the the prior AST file, so references to the higher-numbered ID
that was scheduled for writing go off into lalaland.

To fix this, keep the higher-numbered ID so we end up writing the type
twice. Since this issue occurs so rarely, and type records are
generally rather small, I deemed this better than the alternative: to
keep a separate mapping from the higher-numbered IDs to the
lower-numbered IDs, which we would end up having to check whenever we
want to deserialize any type.

Fixes <rdar://problem/8511624>, I think.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
55f48de5f6b10b50f4d88a9f7235f4532f799550 04-Oct-2010 Douglas Gregor <dgregor@apple.com> When a type comes from a previously-loaded PCH/AST file, don't try to write it into a chained PCH file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
77424bc3794f569816dba52e423b57486a98e5ba 02-Oct-2010 Douglas Gregor <dgregor@apple.com> Implement chained PCH support for the macro definitions stored within
the "detailed" preprocessing record.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
dab60ad68a3a98d687305941a3852e793705f945 01-Oct-2010 Douglas Gregor <dgregor@apple.com> Implement the C++0x "trailing return type" feature, e.g.,

auto f(int) -> int

from Daniel Wallin!

(With a few minor bug fixes from me).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
ee9b0ba29094eb177a285e726ab96e979e5b9c61 01-Oct-2010 Douglas Gregor <dgregor@apple.com> When an identifier that has a macro definition in the original PCH
file is somehow changed in a chained PCH file, make sure that we write
out the macro definition. Fixes part of <rdar://problem/8499034>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
196f557741eeb346cc7cb6aa85f75dd9f82b4a06 28-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> My previous fix was incorrect for non-chained PCH reuse. Fix again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
b57a624f22b1efa873e0abac78128b69fba3d486 28-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> When chaining PCHs, only write PPRecords that don't come from PCH, and give them the correct IDs. Fixes a crash in XCode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114913 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8db9faed418ea743f55c31e1ccecadbb23bd55b7 22-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Change source manager serialization to be less tied to the PCH model.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f73c93fea0d4b447585bc7459499ba6b822e045c 15-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Macro definitions in AST files have their own IDs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114014 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4ea884b429445aa6f1af5bc6e51d0b65a4043e24 07-Sep-2010 Benjamin Kramer <benny.kra@googlemail.com> Replace loops with SmallVector::append.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1d6107c30194f10cb2c634e9d8f8740d660b1644 02-Sep-2010 Benjamin Kramer <benny.kra@googlemail.com> Avoid implicit string construction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112820 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
62c78d54bee499dd87f768f48b21c9b5ec15e516 25-Aug-2010 Chandler Carruth <chandlerc@gmail.com> Rename *PendingImplicitInstantiations to *PendingInstantiations. No
functionality changed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112040 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
2a7fb27913999d132cf9e10e03dc5271faa2e9d3 25-Aug-2010 John McCall <rjmccall@apple.com> Move more stuff out of Sema.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4153a060f4cd03e9db1349328a158e9d898a2610 25-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> AST writer support for having specializations of templates from earlier in the chain. This ought to finish C++ chained PCH support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111986 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7a1fad38256eb4c5129359be85ba1ea1678eb5c9 24-Aug-2010 John McCall <rjmccall@apple.com> Remove a header dependency from Sema.h at the cost of some type safety.
If someone wants to fix this some other way....



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5967d6228f183a5fa384f2f1918df679ed2d8666 24-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Add testcase for C++ chained PCH and fix the bugs it uncovered in name lookup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
1d1e42b17da6a53391d50b08068ecde04311e368 24-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Write visible update blocks. No regressions in normal PCH functionality, but no tests for the chain yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
a60786b46eaa4766bb57fb3ca4e0191b3f73e42a 21-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix an issue with writing to PCH another included PCH, introduced by the "using an AST on-disk hash table for name lookup" commit.

When including a PCH and later re-emitting to another PCH, the name lookup tables of DeclContexts
may be incomplete, since we now lazily deserialize the visible decls of a particular name.
Fix the issue by iterating over the un-deserialized visible decls and completing the lookup tables
of DeclContexts before writing them out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
074dcc8ef8c5df7a155c85648e8eae786bee6cab 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use the AST on-disk hash table for name lookup inside a DeclContext.

*Huge* improvement over the amount of deserializing that we do for C++ lookup.
e.g, if he have the Carbon header precompiled and include it on a file containing this:

int x;

these are the before/after stats:

BEFORE:

*** AST File Statistics:
578 stat cache hits
4 stat cache misses
548/30654 source location entries read (1.787695%)
15907/16501 types read (96.400223%)
53525/59955 declarations read (89.275291%)
33993/43525 identifiers read (78.099945%)
41516/51891 statements read (80.006165%)
77/5317 macros read (1.448185%)
0/6335 lexical declcontexts read (0.000000%)
1/5424 visible declcontexts read (0.018437%)

AFTER using the on-disk table:

*** AST File Statistics:
578 stat cache hits
4 stat cache misses
548/30654 source location entries read (1.787695%)
10/16501 types read (0.060602%)
9/59955 declarations read (0.015011%)
161/43525 identifiers read (0.369902%)
20/51891 statements read (0.038542%)
6/5317 macros read (0.112846%)
0/6335 lexical declcontexts read (0.000000%)
2/5424 visible declcontexts read (0.036873%)

There's only one issue affecting mostly the precompiled preambles which I will address soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
5d26768e2661faa7ce0b55ffff4be8b3969fbbf5 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce the mechanism for building an AST on-disk hash table for name lookup inside a DeclContext but don't use it yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
eb3f04e60fa17dba27344ed89fd1b9134bb6839c 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactoring; move the functionality of ASTWriter::GetOrCreateTypeID to the more generic
MakeTypeID template function which accepts a type and a function object that returns a TypeIdx.

MakeTypeID is in PCHCommon.h so that it can be used by ASTReader too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7fb35182f43392cea4517c203bbabb22364a19fc 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce ASTWriter::GetOrCreateTypeID and move most of the functionality of AddTypeRef there.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
26fca90786af17f97e1a5ecc310d4bf39b831595 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> A bit of refactoring; Introduce ASTWriter::GetOrCreateTypeIdx and move the emission of types there.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
01b81c4d074bba9c18372d521405dfe32fc4f552 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Rename TypeIDs -> TypeIdxs. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c8e5d51f51e46c6f7717761537c6609ef9daf57c 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> serialization::TypeID is used with or without qualifiers, both as index and as index + qualifiers.
Disambiguate and provide some type safety by using a new class TypeIdx for the "TypeID as index" semantics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
0eca89e9890db4d8336ce762a5b359a1d58ca02b 20-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Share the common code of ComputeHash(Selector Sel) instead of keeping 2 copies in PCHReader and PCHWriter.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
8538e8d43a3a9bd439c987c0de37bcbf035dd391 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename pch namespace to serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
f29f0a28c4d9599b389bbb6d186e14af753dc5a3 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename stuff in PCHBitCodes.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
6ab7cd853e9c15cf986a8a7c3db1f8d20e275409 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename the ASTReader header files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
3c7f4134603d04b44f997b43c0a9def270f25386 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> More PCH -> AST renaming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
c43b54cbc10654ed59de797898042e1a05265246 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename PCHReader to ASTReader.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
7faa2ec03a7ef120ac165bb45b6c70a8b20c9f1c 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename PCHWriter.h to ASTWriter.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp
4ee2ad04344446e610172a0e73949212923014df 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename the ASTWriter implementation files

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Serialization/ASTWriter.cpp