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

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

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

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/Frontend/ASTUnit.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Frontend/ASTUnit.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Frontend/ASTUnit.cpp
ee0cd37fe4a9f4e2ee73ae34cf93c410cb299a82 24-Oct-2013 Manuel Klimek <klimek@google.com> Use the same SourceManager for ModuleMaps and compilations.

This allows using virtual file mappings on the original SourceManager to
map in virtual module.map files. Without this patch, the ModuleMap
search will find a module.map file (as the FileEntry exists in the
FileManager), but will be unable to get the content from the
SourceManager (as ModuleMap previously created its own SourceManager).

Two problems needed to be fixed which this patch exposed:

1. Storing the inferred module map
When writing out a module, the ASTWriter stores the names of the files
in the main source manager; when loading the AST again, the ASTReader
errs out if such a file is found missing, unless it is overridden.
Previously CompilerInstance's compileModule method would store the
inferred module map to a temporary file; the problem with this approach
is that now that the module map is handled by the main source manager,
the ASTWriter stores the name of the temporary module map as source to
the compilation; later, when the module is loaded, the temporary file
has already been deleted, which leads to a compilation error. This patch
changes the inferred module map to instead inject a virtual file into
the source manager. This both saves some disk IO, and works with how the
ASTWriter/ASTReader handle overridden source files.

2. Changing test input in test/Modules/Inputs/*
Now that the module map file is handled by the main source manager, the
VerifyDiagnosticConsumer will not ignore diagnostics created while
parsing the module map file. The module test test/Modules/renamed.m uses
-I test/Modules/Inputs and triggers recursive loading of all module maps
in test/Modules/Inputs, some of which had conflicting names, thus
leading errors while parsing the module maps. Those diagnostics already
occur on trunk, but before this patch they would not break the test, as
they were ignored by the VerifyDiagnosticConsumer. This patch thus
changes the module maps that have been recently introduced which broke
the invariant of compatible modules maps in test/Modules/Inputs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e96a7b4d99e8737b1dc8a3bd07038f885bc4263b 15-Oct-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] For an unscoped enum include the enumerators in the top-level code-completion hash since they enter the top-level namespace.

rdar://14703327

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0b5ca510fb00eeb19ab82ebfd3c2585404bc9aa8 13-Sep-2013 David Blaikie <dblaikie@gmail.com> Remove unnecessary inclusion of Sema.h

Let me tell you a tale...

Within some twisted maze of debug info I've ended up implementing an
insane man's Include What You Use device. When the debugger emits debug
info it really shouldn't, I find out why & then realize the code could
be improved too.

In this instance CIndexDiagnostics.cpp had a lot more debug info with
Clang than GCC. Upon inspection a major culprit was all the debug info
describing clang::Sema. This was emitted because clang::Sema is
befriended by DiagnosticEngine which was rightly required, but GCC
doesn't emit debug info for friends so it never emitted anything for
Clang. Clang does emit debug info for friends (will be fixed/changed to
reduce debug info size).

But why didn't Clang just emit a declaration of Sema if this entire TU
didn't require a definition?

1) Diagnostic.h did the right thing, only using a declaration of Sema
and not including Sema.h at all.
2) Some other dependency of CIndexDiagnostics.cpp didn't do the right
thing. ASTUnit.h, only needing a declaration, still included Sema.h
(hence this commit which removes that include and adds the necessary
includes to the cpp files that were relying on this)
3) -flimit-debug-info didn't save us because of
EnterExpressionEvaluationContext, defined inline in Sema.h which fires
the "requiresCompleteType" check/flag (since it uses nested types from
Sema and calls Sema member functions) and thus, if debug info is ever
emitted for the type, the whole type is emitted and not just a
declaration.

Improving -flimit-debug-info to account for this would be... hard.
Modifying the code so that's not 'required to be complete' might be
possible, but probably only by moving EnterExpressionEvaluationContext
either into Sema, or out of Sema.h. That might be a bit too much of a
contortion to be bothered with.

Also, this is only one of the cases where emitting debug info for
friends caused us to emit a lot more debug info (this change reduces
Clang's DWO size by 0.93%, dropping friends entirely reduces debug info
by 3.2%) - I haven't hunted down the other cases, but I assume they
might be similar (Sema or something like it). IWYU or a similar tool
might help us reduce build times a bit, but analyzing debug info to find
these differences isn't worthwhile. I'll take the 3.2% win, provide this
small improvement to the code itself, and move on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
809d254c1f1521c141c8807638c29d67b50ebf29 24-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> This wasn't headers, just missing namespaces.

/me bows head in shame.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
a9bdbce589c28d8e89d816c82fae72a303600994 24-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> Replace compLocDecl with less_first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
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/Frontend/ASTUnit.cpp
4488835d1c78221553909447cf87d7e4ff7f99fb 29-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Update for llvm api change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
aefb1d3312a63ac8d289a2e84747fe61a7f61823 29-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Convert a use of stat with sys::fs::status.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f0c06a3fa424a7bf858d95f6e83c392dbb31ea43 18-Jul-2013 Manuel Klimek <klimek@google.com> Fix crash in libclang if code completion is used with unknown flags.

Use CaptureDroppedDiagnostics to make sure that there is a diagnostic
client installed when warning flags are parsed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
70e7aeccbf5856a84f81366c6c1a0c0c01e70063 05-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Use llvm::sys::fs::createUniqueFile.

Include a test that clang now produces output files with permissions matching
the umask.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1ec4a86a867fc04f35d13bc9e33b04cf2171fe41 05-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Use llvm::sys::fs::createTemporaryFile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
21b1824304076325a72239a4446e5f7e97370cfd 26-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't use PathV1.h in ASTUnit.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1cd7df45ac8909a92a80af4be7ec1bbdcb3a84e7 26-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Remove the last use of PathWithStatus.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
85d28486b781f4e69dbff2d0b0239edc5a31ae16 26-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Use llvm::sys::fs::unique_file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b804cb315cfeebc4d1c4d2d023ffb08440f77254 26-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Remove some uses of llvm::sys::Path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1f3ff6a709432e1131ff802d660def2fab2aea58 24-Jun-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang/codecompletion] Make sure the top-level decl hash takes into account ImportDecls.

The top-level hash is used to determine if we need to update the global code-completion results.
ImportDecls did not affect the hash so a newly introduced ImportDecl would not trigger an update of the global results.

rdar://14202797

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
da4cb0cf401bb546574a7db46e50cda8b9d9c048 20-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Use the new name of getUniqueID.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
105b207db81a4cce4f5e76d8da634d800ff5cb36 18-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Use llvm::sys::fs::GetUniqueID.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
34392373fe25e943586de0fdbe37b806c3f7ff70 11-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Include PathV1.h in files that use it.

This is preparation for replacing Path.h with PathV2.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
739f9e575cfa3ade546b3845eeea86eabd67357f 11-Jun-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Modify a comment to reflect changes of r183717.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b62b8b9aa5ee5035ca1e02e1191a22a21d0228f4 11-Jun-2013 Benjamin Kramer <benny.kra@googlemail.com> ASTUnit: Invert the dependency of PrecompilePreambleAction on PrecompilePreambleConsumer.

Actions outlive consumers. PR16295. Found by AddressSanitizer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1f01f7c160c06f8290b4f1c203e36b242074c6b1 11-Jun-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Allow building a precompiled preamble with compiler errors

A while ago we allowed libclang to build a PCH that had compiler errors; this was to retain the performance
afforded by a PCH even if the user's code is in an intermediate state.

Extend this for the precompiled preamble as well.

rdar://14109828

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3b7deda7137e62810a810ce25b062927a9fc7c71 24-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] If we hit a failure while loading a PCH/module, abort parsing instead of trying to continue in an invalid state.

Also don't let libclang create a PCH with such an error.

Fixes rdar://13953768

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7eca8d2262a26eedb2ff3cc0fd11be2494b17cc1 10-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install the ASTWriter that we create as an ASTMutationListener.

Fixes rdar://13833268

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f9ba851c9b5db8ea30846215e737702a1cc2c194 09-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.

This made sense in pre-module era, before merging of HeaderFileInfos was introduced.

Final part of rdar://13840148.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
fe57db23431463e137c4aaf01d999165c84b0e9f 05-May-2013 Benjamin Kramer <benny.kra@googlemail.com> Use remove_if to erase parts of a vector. Avoids O(n^2) worst cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cc2b653c319599f502425d2c3de29865d47bb9e4 04-May-2013 Douglas Gregor <dgregor@apple.com> Remove DiagnosticConsumer::clone(), a bad idea that is now unused.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
a4a90cabfa15c900016a7cfaea51a6d4e8ebf4db 04-May-2013 Douglas Gregor <dgregor@apple.com> When building a module, forward diagnostics to the outer diagnostic consumer.

Previously, we would clone the current diagnostic consumer to produce
a new diagnostic consumer to use when building a module. The problem
here is that we end up losing diagnostics for important diagnostic
consumers, such as serialized diagnostics (where we'd end up with two
diagnostic consumers writing the same output file). With forwarding,
the diagnostics from all of the different modules being built get
forwarded to the one serialized-diagnostic consumer and are emitted in
a sane way.

Fixes <rdar://problem/13663996>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
44f65a587ee39c20e715c9df411c864d328c71b5 05-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When logging a CXTranslationUnit that came from an AST file, print out the filename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c515978bd3a703aa733f846a0094ffa84d149074 24-Feb-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Use MacroDirective in the preprocessor callbacks to make available the
full information about the macro (e.g if it was imported and where).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
89cf425f1136f8d24a64ed94450e488b6794dfa4 23-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Use 'const Decl *' throughout code completion in Sema


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
eb8fc58241e1781a77c958764e16a4c402e4d707 21-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [ASTUnit] Unlike LoadFromCommandLine, LoadFromCompilerInvocation causes a crash if Precompilepreamble
is set to true because there is no FileManager at that point.

Patch by Hurcan Solter!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d47afb96a3f988e6d21a92fe4dfe875ab227c7c0 20-Jan-2013 Sean Silva <silvas@purdue.edu> Nuke SetUpBuildDumpLog.

Also, it was the only reason that `argc` and `argv` were being passed
into createDiagnostics, so remove those parameters and clean up callers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
814b51a3d572d4e4107e67d549c8a82484ce8160 11-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] In ASTUnit::getMainFileName() Invocation may be null because the ASTUnit
came from loading a PCH/module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
80ad52f327b532bded5c5b0ee38779d841c6cd35 02-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> s/CPlusPlus0x/CPlusPlus11/g


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
ac504561cd888455a48bf85d21ada20a932ebd94 22-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Don't try to translate diagnostics from the precompiled preamble to the
code-completion results, the SourceManager state may be slightly
different when code-completing.

And we don't even care for diagnostics when code-completing, anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
49a87549f4dc95ecb3d8a593b71df7c167a51f85 16-Nov-2012 Douglas Gregor <dgregor@apple.com> Since CreateTargetInfo is taking ownership of the target options, pass
it as a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7fdc8fdbfe0d2b4bc0f1a22b2560ca6d86a72c94 16-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When caching code-completion results, pass the CachedCompletionAllocator
to the CodeCompletionTUInfo that is going to be used to get the results.

Previously we would use ASTUnit's CodeCompletionTUInfo which has its own allocator
that will go away when we reparse. That could result in a use-after-free bug when
getting the parent context name from a CodeCompletionString.

Addresses rdar://12568377.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
c4a77906c259cba58c147d8468c406a430ecdcbb 15-Nov-2012 Dmitri Gribenko <gribozavr@gmail.com> Use empty parens for empty function parameter list instead of '(void)'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8616f9af65b9a3662f2c9dfed38eeabc509f8446 09-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Turn FrontendInputFile into an immutable class and have it also accept
a memory buffer instead of only a filename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167627 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e50904f83b1b09bff487185dd823dfc8415cb300 02-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When code-completing don't disable the preprocessing record if modules are enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
25893e0930c1241c3fdafc6f1b8661443bb19692 31-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Decouple code-completion for the SkipFunctionBodies frontend option and
add a test to make sure code-completion skips bodies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167141 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
badb3f6971bec4a7341ed152d367f27d572682e0 30-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Move getOriginalSourceFileName inline. Patch by Laszlo Nagy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166981 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4399890d385171eff39927a26823426046d33456 25-Oct-2012 Douglas Gregor <dgregor@apple.com> ASTUnit doesn't actually care about the predefines; don't record them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166650 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
36a16498ff911a218f26c7955376bbe99ddb16df 24-Oct-2012 Douglas Gregor <dgregor@apple.com> Teach the preprocessor to hold onto the preprocessor options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166599 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c042edd54face617a3b9d0b4b9d5a3ff229d0f48 24-Oct-2012 Douglas Gregor <dgregor@apple.com> Move HeaderSearchOptions into the Lex library, make it intrusively
reference-counted, and hold a reference to it in HeaderSearch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166583 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
02c23ebf41ae2f70da0ba7337e05c51fbfe35f7f 24-Oct-2012 Douglas Gregor <dgregor@apple.com> Make DiagnosticOptions intrusively reference-counted, and make sure
the various stakeholders bump up the reference count. In particular,
the diagnostics engine now keeps the DiagnosticOptions object alive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166508 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
27ffa6caf965ef20fdef5ae23b81cdc3d05e7afb 23-Oct-2012 Douglas Gregor <dgregor@apple.com> If the precompiled header named by "-include" is actually a directory,
check each of the files within that directory to determine if any of
them is an AST file that matches the language and target options. If
so, the first matching AST file is loaded. This fixes a longstanding
discrepency with GCC's precompiled header implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
38295beb73db5f90bfcf31625fb81dbc3b96290a 23-Oct-2012 Douglas Gregor <dgregor@apple.com> Allow clients of the AST reader to specify what kinds of AST load
failures they know how to tolerate, e.g., out-of-date input files or
configuration/version mismatches. Suppress the corresponding
diagnostics if the client can handle it.

No clients actually use this functionality, yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166449 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4825fd7fbb3fe87cdf8da9bccc1361fac45bdf2d 23-Oct-2012 Douglas Gregor <dgregor@apple.com> Distinguish the various kinds of AST file loading failures:
file corruption, compiler version mismatch, target/language
configuration mismatch, out-of-date AST file. No functionality change
yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
9a022bb007a3e77e1ac1330f955a239cfb1dd0fb 15-Oct-2012 Douglas Gregor <dgregor@apple.com> Teach TargetInfo to hold on to the TargetOptions with which it was
created.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
62288edde26ff4af9fc079c979a0e1bdc577ce9d 10-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When indexing a module file, for the ppIncludedFile callback give
an invalid location if the location points to the synthetic buffer
for the module input.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3da76bfbd24b2747ceb72d1918bbbe3123dac841 03-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When indexing, invoke the importedASTFile for PCH files as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
95c579cae01118eadd311d445ff7f491d0011fb0 03-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Some renames to use the 'visitor' nomenclature, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
632dcc92f60ab7f806a89c5bca3a0951763a9219 02-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When indexing an AST file, only deserialize the preprocessing record
entities of the current primary module.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c04bb926ef693c94560da254e87926e93bb9c92f 27-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Always report a CXCursor_MacroDefinition for code-completion
results for a macro name, not CXCursor_NotImplemented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164740 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e6d22027bc22d3767a2acdc80299c76b91159867 26-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Have ASTUnit::Save() return a bool to indicate save error.

Removes a dependency of ASTUnit to clang-c/Index.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
98e95bf1c84560684356088af7f4878bdacb5856 15-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow disabling PCH validation when loading an AST file by checking
an environment variable for debugging purposes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7f1863326488813e7648845f3cec5225770b1a0b 14-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When loading an AST file, make sure to apply the language options
to the target info.

Related to rdar://12069503.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
026b3588b9916f3fcb20ad2f02ca5472cbbdc5d7 14-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix undefined behavior in code completion, caught by
-fcatch-undefined-behavior. Don't try to fit 34 different flags
into 32 bits. Also, don't use 32-bit signed left shifts for this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
ff398965a5abfaf5bc47bc022876f56a28e5b9a7 11-Jul-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
817881376e3a40ca54376547dd1cb9ca5def7190 03-Jul-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Protect against a race condition where a thread
may be destroying an ASTUnit while cleanupOnDiskMapAtExit is
getting called.

rdar://11781241

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d99ef536b241071b6f4c01db6525dc03242ac30b 02-Jul-2012 Dmitri Gribenko <gribozavr@gmail.com> Add a new libclang completion API to get brief documentation comment that is
attached to a declaration in the completion string.

Since extracting comments isn't free, a new code completion option is
introduced.

A new code completion option that enables including brief comments
into CodeCompletionString should be a, err, code completion option.
But because ASTUnit caches global declarations during parsing before
even completion consumer is created, the option is duplicated as a
translation unit option (in both libclang and ASTUnit, like the option
to cache code completion results).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
374a00bcc6e26b4fc3cd1d378a5d056c4c7d618e 08-Jun-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Don't crash when saving a PCH from a prefix header
that does not exist.

rdar://11607033

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d6277fb9e0353edffc0d6c8655a65542c08cf6f1 21-May-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [driver] When creating the compiler invocation out of command-line
arguments, force use of clang frontend for the driver.

Fixes rdar://11356765.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bcadf96a75942f528fc0683d953d66589d341909 14-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> ASTUnit: Don't clone the new DiagnosticConsumer, causing it to get leaked.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
6a91d385618ea4d28236c496f540a26877c95525 12-Apr-2012 Erik Verbruggen <erikjv@me.com> Added a flag to the parser to skip method bodies.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e722ed6f5464232e23be52f4976312ef526fae99 11-Apr-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] If displayDiagnostics is set (when calling clang_createIndex), make sure to
output the errors that occurred even if we did not get an AST (e.g. because the
PCH failed to load).

Also honor displayDiagnostics in clang_indexSourceFile().

rdar://11203489

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
28a83f57003469fb615ad27dd34bcf5b0a10da8c 10-Apr-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [code-complete] Introduce CodeCompletionTUInfo which will be used for caching
code-completion related strings specific to a translation unit (ASTContext and related data)

CodeCompletionAllocator does such limited caching, by caching the name assigned
to a DeclContext*, but that is not the appropriate place since that object has
a lifetime that can extend beyond that of an ASTContext.

Introduce CodeCompletionTUInfo which will be always tied to a translation unit
to do this kind of caching and move the caching of CodeCompletionAllocator into this
object, and propagate it to all the places where it will be needed.

The plan is to extend the caching where appropriate, using CodeCompletionTUInfo,
to avoid re-calculating code-completion strings.

Part of rdar://10796159.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4bd265468cb115efd5c87c59d5a5b6af5d24d48c 13-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When there's a file error when saving the PCH, make sure to
clear the error from raw_fd_ostream, otherwise we will crash.

rdar://10976410

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
8d6ff02cb78c67c615125782967b44d1b37e5815 29-Feb-2012 Daniel Dunbar <daniel@zuster.org> Serialization: Switch over to using the native SmallVector based BitstreamWriter
ctor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e1d4330adaaa7faf093e725c9c993207eb2d778a 25-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't record nested macro expansions in the preprocessing record,
it can only bring pain when dealing with preprocessor abuse (see: boost).

rdar://10898986

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c93dc7889644293e318e19d82830ea2acc45b678 20-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import IntrusiveRefCntPtr<> into clang namespace

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
6f42b62b6194f53bcbc349f5d17388e1936535d7 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import OwningPtr<> into clang namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7f3a458cd46f19a854fb710fa9d27c411ddd5101 01-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Make sure we don't ever leave a StoredDiagnostic associated with
a SourceManager that has already been deleted, rdar://10768346.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
dc58aa71026cce539ca9b5c2c52cc4efc7bd77fe 30-Jan-2012 Douglas Gregor <dgregor@apple.com> Thread a TargetInfo through to the module map; we'll need it for
target-specific module requirements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
85ae12db3bbc60b920c086f1cb23cc94ad4802ae 29-Jan-2012 Douglas Gregor <dgregor@apple.com> Ensure that we clean up after a failed module build and cope with the
results in libclang.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1f6b2b5c82b2d2d3935b0db76352a04e9877b73f 20-Jan-2012 Douglas Gregor <dgregor@apple.com> Extract the (InputKind, std::string) pair used to describe inputs to
the front end into its own class, FrontendInputFile, to make it easier
to introduce new per-input data. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7fe90f3bfa6bd7f779ecfd4ba201a296a3a1c8cb 17-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Make sure Preprocessor is set in ASTUnit during indexing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
8d2a701734f6e0aa778f6be4e6b6d561d8ba6fdb 25-Dec-2011 Rafael Espindola <rafael.espindola@gmail.com> Remove unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
9870401105660efb1c393829e08eae44e0583b3d 29-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Initialize NumWarningsInPreamble in ASTUnit's constructor, for safety.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
6f3ce979a7748fd117e6473d6272b16d643b6262 28-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Indexing API: If the client requested to get a CXTranslationUnit after
indexing, honor all the TU options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
991bf49f68e8caeb900dd9738712b861073363d9 28-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Indexing API: Capture diagnostics during indexing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145228 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c14a03dffff69b5e1c55cc118fc52d8fd9f3a28d 23-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Fix operations (token annotation, getting cursor, etc.) with a file region
inside an objc container that "contains" other file-level declarations.

When getting the array of file-level declarations that overlap with a file region,
we failed to report that the region overlaps with an objc container, if
the container had other file-level declarations declared lexically inside it.

Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST
and handling them appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145109 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
88c2596edc8eb475e20f6033de1ea01669695a0c 18-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d3b74d9ca4f239a7a90ad193378c494306c57352 18-Nov-2011 Ted Kremenek <kremenek@apple.com> Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted object. I discovered that llvm::RefCountedBase<T> has
a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation
objects created by ASTUnit were actually leaked. When I fixed that bug locally, it showed that a whole bunch of code assumed
that the LangOptions object that was part of CompilerInvocation was still alive. By making it heap-allocated and reference counted,
we can keep it around after the CompilerInvocation object goes away.

As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this
object may outlive the CompilerInvocation object.

This commit doesn't fix the CompilerInvocation leak itself. That will come when I commit the fix to llvm::RefCountedBase<T> to
mainline LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d04a982d3472d98e58f58dfc327ca11e236980f5 18-Nov-2011 Ted Kremenek <kremenek@apple.com> Simplify crash cleanup logic in ASTUnit::LoadFromCommandLine() by zeroing out two IntrusiveRefCnt pointers after we have assigned their respective values into fields of ASTUnit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
35593a9add85353532519f8eba5ec513a611aac5 16-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Fix crash on invalid code. Fixes rdar://10451854

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8e23806863721495f9e1f84aed614f7afba774a3 11-Nov-2011 Douglas Gregor <dgregor@apple.com> I predict that HeaderSearch will need the ability to generate
diagnostics in the future. Make it so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
66e870029fdc1a36e79e62fd64430b527a318868 07-Nov-2011 Douglas Gregor <dgregor@apple.com> ASTConsumer::handleTopLevelDecl will end up getting called for
function template instantiations. Fixes <rdar://problem/10398005> / PR11312.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
27368f9f1942a42b668cd1d9426859566c4f8540 03-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> After resetting the diagnostic state, set the number of warning occurring in the preamble.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e6825d39e89362105171c013f4018c4d1134ad6f 03-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Fix crash when a #pragma diagnostic is included in the preamble.

A PCH file keeps track of #pragma diagnostics state; when loading the preamble, they conflicted
with the #pragma diagnostic state already present in the DiagnosticsEngine object due to
parsing the preamble.

Fix this by clearing the state of the DiagnosticsEngine object.
Fixes rdar://10363572 && http://llvm.org/PR11254.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143644 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
dfb332d0081c6641d1dbae6a2aeff757c99cc740 03-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Add infrastructure to be able to only deserialize decls in a file region and
use it for clang_getCursor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
62ba9f61af6177992d8cd2e3306257e1213b1bd3 01-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Put a reference of the ASTReader in the ASTUnit.

This is intended for direct access of the ASTReader for uses that make
little sense to try to shoehorn in the ExternalASTSource interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
2fe17fc5ead5e42ef195618228bca53c79e0e50d 31-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert r143342. Caching of code-completion results was intentionally placed in "reparse"
because we don't want to take this performance hit when doing code completion

Log of r143342:
Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete,
so that it will happen when we are doing code-completion, not reparsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
092294918b5649cac05d6442aae75f7904ef772e 31-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete,
so that it will happen when we are doing code-completion, not reparsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
332cb9be88fd2d1b294a2fbc299c354e93be673c 31-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Have the ASTUnit associate the local declarations that get parsed with the file
that contains them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e055f8a1d8a33511394302d38af7ab0fbd2c35fa 27-Oct-2011 Ted Kremenek <kremenek@apple.com> Add mutex for accessing ASTUnit's global OnDisk data. This may be an issue as libclang could be processing multiple ASTUnit's at once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1872b3153a388b3a548c9f699cbc348128059be9 27-Oct-2011 Ted Kremenek <kremenek@apple.com> Move ASTUnit's handling of temporary files and the preamble file into a lazily-created static DenseMap. This DenseMap is cleared (and the files erased) via an atexit routine in the case an ASTUnit is not destroyed. Fixes <rdar://problem/10293367>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143115 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f226ff9fe8c8db6c5b74a61ce649eda1491c3502 25-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When visiting preprocessed entities, make it possible to avoid deserializing
preprocessed entities that are #included in the range that we are interested.

This is useful when we are interested in preprocessed entities of a specific file, e.g
when we are annotating tokens. There is also an optimization where we cache the last
result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if
there is a call with the same range as before.

rdar://10313365

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3e9d32656a8a3a787f64f9beeef66d2d700eb85d 24-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Make sure we don't try to erase past the StoredDiagnostics vector.

Ted came upon the bug but I couldn't make a test out of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
abb5afadd11b19568359880faa5d966a4e33551c 14-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow calling ASTUnit::LoadFromCompilerInvocationAction with a previously created ASTUnit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
a696ece1ac449a2b77e7c0a693b55cb10e9e2068 10-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Implement ConcurrencyCheck using a recursive mutex to allow re-entrancy in the same thread.
The checks are performed only in DEBUG, it becomes no-op in release mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
aee526e77657afd1600276450e9c346953ad51d7 29-Sep-2011 Douglas Gregor <dgregor@apple.com> Introduce a pure virtual clone() method to DiagnosticConsumer, so that
we have the ability to create a new, distict diagnostic consumer when
we go off and build a module. This avoids the currently horribleness
where the same diagnostic consumer sees diagnostics for multiple
translation units (and multiple SourceManagers!) causing all sorts of havok.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140743 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
ee0f84fc84ed7de7975e102668d8e53a778f7a8c 26-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't map a file:line:col triplet that is inside the preamble range to
a "loaded" location of the precompiled preamble.

Instead, handle specially locations of preprocessed entities:
-When looking up for preprocessed entities, map main file locations inside the
preamble range to a preamble loaded location.
-When getting the source range of a preprocessing cursor, map preamble loaded
locations back to main file locations.

Fixes rdar://10175093 & http://llvm.org/PR10999

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
40847cfb58acc3cac7d68727df9455ac45f2e118 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename DiagnosticInfo to Diagnostic as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
26e7a90c7c74b0ecd8d3f19e216c72a8849017ae 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename StoredDiagnosticClient to StoredDiagnosticConsumer as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
78ad0b98848c17a0a11847fa1d456e2dfec8aa2f 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename DiagnosticClient to DiagnosticConsumer as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
507097ec40105ed927cb5a744fad98f5875aacac 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
26d43cd3a088d4f1f1645328db3b73afbc7eaa61 12-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] In ASTUnit::Parse copy the CompilerInvocation object instead of
modifying directly for the preamble.

This avoids an awful, hard to find, bug where "PreprocessorOpts.DisablePCHValidation = true"
would be persistent for subsequent reparses of the translation unit which would result
in defines, present in command-line but not in the PCH, being ignored.

Fixes rdar://9615399.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
08e0bc16b3312c27e87d33be7dcf3d4fe5bdd2e2 10-Sep-2011 Douglas Gregor <dgregor@apple.com> Kill of the Decl::PCHLevel field entirely. We now only need to know
whether a Decl was deserialized from an AST file (any AST file).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c8c97a03eb0fdeb4f5fc9c4dea308ebbf46c2c93 04-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix Lexer::ComputePreamble when MaxLines parameter is non-zero.

The function was only counting lines that included tokens and not empty lines,
but MaxLines (mainly initiated to the line where the code-completion point resides)
is a count of overall lines (even empty ones).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f8a1e51c48761ee1d7803c3fa35ac94f42ebb55e 02-Sep-2011 Douglas Gregor <dgregor@apple.com> Always construct an ASTReader with a non-NULL ASTContext and
Preprocessor, eliminating the constructor that was used by ASTUnit
(which didn't provide an ASTContext or Prepreprocessor). Ensuring that
both objects are non-NULL will simplify module loading (but none of
that is done yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138986 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
998b3d3e8528ebd9d2c5d78d3a82edd90a8953a4 02-Sep-2011 Douglas Gregor <dgregor@apple.com> Allow the preprocessor to be constructed without performing target-
and language-specific initialization. Use this to allow ASTUnit to
create a preprocessor object *before* loading the AST file. No actual
functionality change.


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




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
95ed7784a335aca53b0c6e952cf31a4cfb633360 27-Aug-2011 Fariborz Jahanian <fjahanian@apple.com> objective-c: Treat top-level objective-c declarations
, such as list of forward @class decls, in a DeclGroup
node. Deal with its consequence throught clang. This
is in preparation for more Sema work ahead. // rdar://8843851.
Feel free to reverse if it breaks something important
and I am unavailable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138709 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
6aa52ec6b969faabf3764baf79d89810b8249a7e 27-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce support for a simple module import declaration, which
loads the named module. The syntax itself is intentionally hideous and
will be replaced at some later point with something more
palatable. For now, we're focusing on the semantics:
- Module imports are handled first by the preprocessor (to get macro
definitions) and then the same tokens are also handled by the parser
(to get declarations). If both happen (as in normal compilation),
the second one is redundant, because we currently have no way to
hide macros or declarations when loading a module. Chris gets credit
for this mad-but-workable scheme.
- The Preprocessor now holds on to a reference to a module loader,
which is responsible for loading named modules. CompilerInstance is
the only important module loader: it now knows how to create and
wire up an AST reader on demand to actually perform the module load.
- We search for modules in the include path, using the module name
with the suffix ".pcm" (precompiled module) for the file name. This
is a temporary hack; we hope to improve the situation in the
future.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b5af843a20e237ad1a13ad66a867e200695b8c8e 26-Aug-2011 Douglas Gregor <dgregor@apple.com> Eliminate the -chained-pch flag and all of the frontend and libclang options associated with it. Chained PCH is the only way to build a PCH file that includes another PCH file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
9293ba8e26fcba18505b273ecc9b66645133fcce 26-Aug-2011 Douglas Gregor <dgregor@apple.com> Remove the Chaining argument from the PCH/module generator. It's no longer used

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
467dc88512b4ba4bb16e274ea3771dc1415d31da 26-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce a -cc1 option "-emit-module", that creates a binary module
from the given source. -emit-module behaves similarly to -emit-pch,
except that Sema is somewhat more strict about the contents of
-emit-module. In the future, there are likely to be more interesting
differences.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
03c107a42fae79e89d0016999a1a04c07d65591a 25-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may be
out-of-sync how a file is compiled. Patch by Matthias Kleine!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138580 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
01a429a1029dd650ed11cc35160451664f664df3 17-Aug-2011 NAKAMURA Takumi <geek4civic@gmail.com> [MSVC] Fix a warning C4334 "'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8fa0a80b4482ad94e82c4a19e23de17fd69140b5 04-Aug-2011 Douglas Gregor <dgregor@apple.com> Add a new libclang API to return a CXCompletionString for an arbitrary
cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0f91c8ccb398be2bd40dc402309bd79737542396 30-Jul-2011 Douglas Gregor <dgregor@apple.com> When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7e90985df09855dc309ed888a5b16a0ae684f8e3 28-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Cut down the number of open/close system calls for output files.

For PCH files, have only one open/close for temporary + rename to be safe from race conditions.
For all other output files open/close the output file directly.

Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
9461fccd05bde8458710ba367be10b6e4efe2ec7 22-Jul-2011 Jonathan D. Turner <jonathan.d.turner@gmail.com> Remove prepending of '$' to module names.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
9cca68dbfc42f7778f8db0bcfe8b3e575599ac0f 21-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For ASTUnit::Save, write the AST to a temporary and then rename it to the actual filename.
Should avoid race conditions. Addresses rdar://9788943.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135691 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bc9d5a3ace7cb75e4bff3dd4a3999a3fc04f4d45 21-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Cut down one open/close pair of system calls by using Path's makeUnique instead of createTemporaryFileOnDisk.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
e9c0265d6e6b5bf865f4a0c2c00d00ac251e6437 18-Jul-2011 Frits van Bommel <fvbommel@gmail.com> Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
ba7537febdf1bc1cc617e1f1746f2644feba6274 14-Jul-2011 Chandler Carruth <chandlerc@gmail.com> NestedMacroInstantiations -> NestedMacroExpansions

This is switches all the interfaces points (and most of the commenst
/ local variables I saw on my way through) regarding the
NestedMacroInstantiations bit.

The libclang enums corresponding to this state were renamed, but
a legacy enum was added with the old name, and the same value to keep
existing clients working. I've added a documentation blurb for it, but
let me know if there is a canonical way to document legacy elemenst of
the libclang interface.

No functionality changed here, even in tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135141 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3da626b4f38eb0350de960d71271ca77af7a9cc8 07-Jul-2011 Douglas Gregor <dgregor@apple.com> Introduce a new libclang aPI function,
clang_codeCompleteGetContexts(), that provides the client with
information about the context in which code completion has occurred
and what kinds of entities make sense as completions at that
point. Patch by Connor Wakamo!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
85bea9777d444ccbcc086d98f075fe666c2e865d 06-Jul-2011 Douglas Gregor <dgregor@apple.com> Keep track of when "unrecoverable" errors occur, then allow
clang_saveTranslationUnit() to save a PCH file if the only errors it
contains are recoverable errors. Fixes <rdar://problem/9727804>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
39c411fa229b2a6747b92f945d1702ee674d3470 06-Jul-2011 Douglas Gregor <dgregor@apple.com> libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
01b6e31a62e2265849f4388b9be6be0a5d13348d 01-Jul-2011 Douglas Gregor <dgregor@apple.com> When we create a precompiled preamble, don't copy the
CompilerInvocation on the stack, because other objects (e.g., the
CompilerInstance) maintain an intrusive reference-counted pointer to
the CompilerInvocation. This doesn't matter in the normal case,
because we take back the CompilerInvocation. However, during crash
recovery, this leads to us trying to free an object on the stack, and
hilarity ensues. Fixes <rdar://problem/9652540>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
dca8ee8b7bc86076916a3a80f553f7a4e98c14af 06-May-2011 Douglas Gregor <dgregor@apple.com> Introduce a new libclang parsing flag,
CXTranslationUnit_NestedMacroInstantiations, which indicates whether
we want to see "nested" macro instantiations (e.g., those that occur
inside other macro instantiations) within the detailed preprocessing
record. Many clients (e.g., those that only care about visible tokens)
don't care about this information, and in code that uses preprocessor
metaprogramming, this information can have a very high cost.

Addresses <rdar://problem/9389320>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8c647deada0c0e8407b4ced00ff09be1261fe147 05-May-2011 Ted Kremenek <kremenek@apple.com> ASTUnit::LoadFromASTFile(): recover the resources from an ASTReader if it crashes during PCH validation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d808bd2978bd4ac95a92b309b038452b533fd7a0 04-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce ASTUnit::LoadFromCompilerInvocationAction that allows one to create an ASTUnit
from a CompilerInvocation along with an ASTFrontendAction to invoke, and without all the goo
about the precompiled preamble.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
832316e9a04242972f4b57281dccb8e4cf5894ea 05-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move Driver::createInvocationFromArgs function to Frontend library to avoid dependency cycle
between libFrontend and libDriver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
054e4f50e2f1995e91b0cd3c3258aa252785fe3f 04-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce Driver::createInvocationFromArgs used to create a CompilerInvocation from command-line args.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7f9fc3f7ce076645cb6aefc99c64d9446caf13d6 23-Mar-2011 Chris Lattner <sabre@nondot.org> switch a few Driver APIs to use llvm::ArrayRef, cleaning up code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
114d63955f8d55e4c2f0350abf907fbb5eeeb08b 23-Mar-2011 Ted Kremenek <kremenek@apple.com> std::vector::data() is not portable to VS. Use a gross hack instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
25a11e1c5fad62dbad25a265e334720157e3fbc1 22-Mar-2011 Ted Kremenek <kremenek@apple.com> Rework crash recovery cleanup in ASTUnit and CIndex to recover more memory during a Sema crash (we have just a handful of leaks left)
and to use the simplified cleanup registration API.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
03201fbbdeb3eb7f465610b09c281ee6aa84e3ca 21-Mar-2011 Ted Kremenek <kremenek@apple.com> Use CrashRecoveryContextCleanup objects to reclaim resources from CompilerInstance objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
340415c0c7a7fdeb688fe5a0993bdd142cc9f59c 18-Mar-2011 Anders Carlsson <andersca@mac.com> Use the newly added FileManager::getNoncachedStatValue when trying to determine if any files in the preamble have changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0d8d7e6067f9093e7d5abc45c9639ab977aab692 18-Mar-2011 Anders Carlsson <andersca@mac.com> Correctly store and keep track of the FileSystemOptions in ASTUnit and in clang_codeCompleteAt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b547eebdffb07dbc2a8239ca93b696b051096933 18-Mar-2011 Ted Kremenek <kremenek@apple.com> Use CrashRecoveryContextCleanup objects to recover an ASTUnit if we crash in ASTUnit::LoadFromCommandLine() and ASTUnit::LoadFromCompilerInvocation().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b0f4b9a558933b307073f7cd7753602f94354ae9 09-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce '-chain-include' option to specify headers that will be converted to chained PCHs in memory
without having to use multiple runs and intermediate files.

Intended for testing & debugging of chained PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
299a4a967b02c9f0d0d94ad8560e3ced893f9116 09-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.

Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4e03c2b9d735063a60cd0623423f4814178857ef 07-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow passing '-###' to ASTUnit::LoadFromCommandLine to print out the cc1 options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
15727ddb11405c45372150b5bfb07dbfa4c9960b 05-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce OwnsRemappedFileBuffers field in ASTUnit, indicating whether the ASTUnit should delete the remapped buffers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
277a6e752512cff286190d35cb353ce717e86b18 23-Feb-2011 Nick Lewycky <nicholas@mxc.ca> Preserve what the user passed to -include when emitting .d files. Fixes PR8974!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
5c722c7020b33da57090422b854072258a50b3f0 19-Feb-2011 Douglas Gregor <dgregor@apple.com> When code-completing a case statement for a switch on a value of
enumeration type, prioritize the enumeration constants and don't
provide completions for any other expressions. Fixes <rdar://problem/7283668>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
48601b32321496b07a18fb6631f8563275d8c5fb 16-Feb-2011 Douglas Gregor <dgregor@apple.com> Teach the CXCodeCompleteResults results structure, which stores
code-completion results accessed via libclang, to extend the lifetime
of the allocator used for cached global code-completion results at
least until these completion results are destroyed. Fixes
<rdar://problem/8997369>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
9b7db6200d366e4964d63ae1f33c7b9d7b9831cb 16-Feb-2011 Douglas Gregor <dgregor@apple.com> Improve the invalidation logic for the cache of global code
completions. We now compute a hash of the names of all top-level
declarations and macro definitions, and invalidate the cache when the
hash value changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125670 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
0a480293f726508ad9aed0be39e8c9779e84f2f2 11-Feb-2011 Douglas Gregor <dgregor@apple.com> Rename the operation that loads a preprocessed entity from a given offset to indicate that we're loading from an offset, not an index, lest one be confused. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8ef6c8cb6c5627240e2339fd7062c9873f821d7e 05-Feb-2011 Douglas Gregor <dgregor@apple.com> Improve our uniquing of file entries when files are re-saved or are
overridden via remapping. Thus, when we create a "virtual" file in the
file manager, we still stat() the real file that lives behind it so
that we can provide proper uniquing based on inodes. This helps keep
the file manager much more consistent.

To take advantage of this when reparsing files in libclang, we disable
the use of the stat() cache when reparsing or performing code
completion, since the stat() cache is very likely to be out of date in
this use case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124971 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
dae687575010c9c49a4b552f5eef82cd6279d9ac 01-Feb-2011 Douglas Gregor <dgregor@apple.com> Create a special allocator class for code completion, so that all of
the string copying goes through a single place that can have
associated state.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
218937c13ef5b0625a70aad41ca7a92da9278bd2 01-Feb-2011 Douglas Gregor <dgregor@apple.com> Allocate CodeCompletionString and all of its components in a
BumpPtrAllocator, rather than manually new/delete'ing them. This
optimization also allows us to avoid allocating memory for and copying
constant strings (e.g., "return", "class").

This also required embedding the priority and availability of results
within the code completion string, to avoid extra memory allocation
within libclang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1aa27307c462baaa9e5fda14ff6797dd39fe8b84 27-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach ASTUnit to save the specified target features, since
TargetInfo::CreateTargetInfo() mangles the target options in a way
that is not idempotent. Fixes <rdar://problem/8807535>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0b53cf834346d78985aaa9e7300445a39c245614 19-Jan-2011 Douglas Gregor <dgregor@apple.com> Don't silently drop warning flags passed in to
clang_createTranslationUnitFromSourceFile().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d64f4c14029f970caafb0bdfcf07f9fecfe5c68b 09-Dec-2010 Douglas Gregor <dgregor@apple.com> Gather cached code completions after the first reparse, not after the
second reparse.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1fd9e0def66fbd50e99be5ff87c9fd1c91c428ab 07-Dec-2010 Douglas Gregor <dgregor@apple.com> Use atomic operations for libclang's object count tracking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
7f946ad40877df749ad05392cc4b80dc4189d28f 29-Nov-2010 Douglas Gregor <dgregor@apple.com> When performing code completion within ASTUnit, allocate the AugmentedCodeCompleteConsumer on the heap, so it's always cleaned up properly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
75dfb65c38d51772df9a00ce2d2feeefd55667ad 23-Nov-2010 Chris Lattner <sabre@nondot.org> tidy up. Split FileManager::getBufferForFile into
two copies, since they are fundamentally different
operations and the StringRef one should go away
(it shouldn't be part of FileManager at least).

Remove some dead arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
39b49bcaaddb1049234fca9500c0ac02c088e23d 23-Nov-2010 Chris Lattner <sabre@nondot.org> now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code.
This also fixes a latent bug in ASTUnit where it would invoke
methods on FileManager without creating one in some code paths
in cindextext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7ad97ffa631af6ad678c79b38341ac995f347ce9 23-Nov-2010 Chris Lattner <sabre@nondot.org> give FileManager a 'FileSystemOptions' ivar, which will be used
to simplify a bunch of code in it. It should ultimately get inlined
into FileManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
151466a18671df9cfd9abd59ba53df35b1d687da 23-Nov-2010 Chris Lattner <sabre@nondot.org> Partially revert Doug's PCH validation patch (r98585).

This patch completely defeated the "passing in a prestat'd size
to MemoryBuffer" optimization, leading to an extra fstat call for
every buffer opened, in order to find out if the datestamp and size
of the file on disk matches what is in the stat cache.

I fully admit that I don't completely understand what is going on here:
why punish code when a stat cache isn't in use? what is the point of a
stat cache if you have to turn around and stat stuff to validate it?

To resolve both these issues, just drop the modtime check and check the
file size, which is the important thing anyway. This should also resolve
PR6812, because presumably windows is stable when it comes to file sizes.
If the modtime is actually important, we should get it and keep it on the
first stat.

This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up
system time on -Eonly Cocoa.h from 0.041 to 0.038s.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f2224d89a6ae65a3839529e26d0f6d025d83d6bb 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Since multiple diagnostics can share one diagnostic client, have the client keeping track
of the total number of warnings/errors reported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e3c60a7ce9e0f42c7ca2344b33203266aceca1db 17-Nov-2010 Douglas Gregor <dgregor@apple.com> Fix source-range information for Objective-C properties. Previously,
we were just getting a range covering only the property name, which is
certainly not correct (and broke token annotation, among other
things).

Also, teach libclang about the relationship between
@synthesize/@dynamic and @property, so we get property name and
cursor-reference information for @synthesize and @dynamic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119409 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
73fc91275a4dc7cb0b0b12a8022319ea78c1f9fe 16-Nov-2010 Douglas Gregor <dgregor@apple.com> Use an OwningPtr for the preamble buffer in ASTUnit. This plugs a leak
where we failed to free this buffer along one of the paths, and
detangles the code a little.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
08bb4c622d0b79c33b4ac78ce1bec79398953daa 16-Nov-2010 Douglas Gregor <dgregor@apple.com> Tweak libclang's heuristics for building precompiled preambles and
caching global code-completion results. In particular, don't perform
either operation the first time we parse, but do both after the first
reparse.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e47be3e9682e82da15059006f43c7f3c021e4fff 11-Nov-2010 Douglas Gregor <dgregor@apple.com> Improve ASTUnit's capture of diagnostics so that the
diagnostic-capturing client lives as long as the ASTUnit itself
does. Otherwise, we can end up with crashes when we get a diagnostic
outside of parsing/code completion. The circumstances under which this
happen are really hard to reproduce, because a file needs to change
from under us.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
edfb7ecea0222be2796469f8c41b836129f833f8 09-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c198f6170f9a66a78f12ab014694e2f5701f7f19 07-Nov-2010 Ted Kremenek <kremenek@apple.com> Change the StringSet used by CalculateHiddenNames() to use a BumpPtrAllocator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
389db16c63eec6ecfa9b235155252d8da766e94e 03-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement -working-directory.

When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
This helps both when using libclang (where we can't require the user to actually change the working directory)
and to help reproduce test cases when the reproduction work comes along.

--FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
the working directory value if set).
--FileSystemOptions are passed around to various interfaces that perform file operations.
--Opening & reading the content of files should be done only through FileManager. This is useful in general since
file operations will be abstracted in the future for the reproduction mechanism.

FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
FileManager but with different FileSystemOptions.

Addresses rdar://8583824.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
9dba61a1e46099b77adf15de224aaa16037a7fff 01-Nov-2010 Douglas Gregor <dgregor@apple.com> Disable some timing code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
213f18b3d654de7d1c7cf4a329ea9d3db1c50b6a 28-Oct-2010 Douglas Gregor <dgregor@apple.com> Simplify ASTUnit's internal timers, by not trying to keep a pile of
timers to be dumped whenever the ASTUnit is destroyed. Instead, just
print the time elapsed for each operation after we perform the
operation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
99ba202f659e1885fa5ee114f97c97cf6a857491 27-Oct-2010 Douglas Gregor <dgregor@apple.com> Introduce libclang-level options for C++ precompiled preambles,
separating out chaining precompiled preambles from non-chaining ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d54eb4410330383f48d3cc22b2ad8d23f120836b 12-Oct-2010 Douglas Gregor <dgregor@apple.com> Parse default arguments within member functions in source order, from
Manuel Klimek! Fixes PR7715.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4cd912aa94656697a44c3ebb159f05060300524e 12-Oct-2010 Douglas Gregor <dgregor@apple.com> When we load an ASTUnit from command-line arguments, hold on to the
diagnostics produced by the driver itself. Previously, we were
allowing these to either be dropped or to slip through to stderr.

Fixes <rdar://problem/7595339>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
32be4a588fbb87d0d163ead49c42f5438bf0b2b7 11-Oct-2010 Douglas Gregor <dgregor@apple.com> Switch c-index-test from clang_codeComplete() over to
clang_codeCompleteAt(). This uncovered a few issues with the latter:

- ASTUnit wasn't saving/restoring diagnostic state appropriately between
reparses and code completions.
- "Overload" completions weren't being passed through to the client



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
aa3e6babe646329310388e5b7e0c9045e0018715 08-Oct-2010 Douglas Gregor <dgregor@apple.com> Fix three related, wily issues with the recompilation of precompiled
preambles:

- When we rebuild a precompiled preamble, make sure to disable
skipping anything in the main file; we may have had leftover
preamble-skipping values in the lexer, which leads to very empty
preamble. This is a correctness issue.

- When we rebuild a precompiled preamble, clear out any prior state
in the Diagnostic object. Otherwise, we might think that there
were errors when we were building the preamble itself, and
therefore reject the resulting preamble. This is mainly a
performance issue.

- Don't remove old remappings when digging out the remapping for the
main file. Having the old mappings around does not hurt in the
common case (later remappings will just overwrite them), and is
important when we fail to find a preamble: we don't want to have
removed the remapping, because we'll need it later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3552f66f8a42021811e8ab9d4a9dfd337df2f969 07-Oct-2010 Douglas Gregor <dgregor@apple.com> Don't force spell checking when code-completing. Let the client decide

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
37cf66350cb5a2bb68b0b7c7cca552f7a4867348 06-Oct-2010 Douglas Gregor <dgregor@apple.com> Fix a double-free error that can occur in rare cases where loading
of the precompiled preamble (or any PCH file it depends on) fails
during reparsing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1d9f1fe7173e3084325f43c78af812a36d8a2a7c 05-Oct-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Give every file that ASTReader loads a type: module, PCH, precompiled preamble or main file. Base Decls' PCHLevel on this to make it more sane.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115626 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
85e5191934143edfa9fed582149d8f85c99c753f 01-Oct-2010 Douglas Gregor <dgregor@apple.com> Enable chained precompiled headers for use with precompiled preambles

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
06e504462014b0506a70c7730ea45c551a103364 27-Sep-2010 Douglas Gregor <dgregor@apple.com> Remove libclang logging code

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114836 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
76dc8890b6c5223de80be8284adbfc63ceeb3a55 25-Sep-2010 Douglas Gregor <dgregor@apple.com> When setting the globally-visible declarations for a particular
identifier, we may have a Sema object but no translation unit scope
(because parsing is finished). In this case, we still need to update
the IdResolver, which might still be used when writing a PCH
containing another PCH (without chaining). This bug manifested as a
failure with precompiled preambles.

Also, add a little environment-variable-sensitive logging for
libclang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8c8d5412cddcc1c45beb0353d91d7894db74e585 24-Sep-2010 Douglas Gregor <dgregor@apple.com> Teach libclang to enable multithreading in LLVM, since libclang clients are likely to be multithreaded. Also move the printing of timers to somewhere better for multithreaded libclang clients

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
52779fb71795534d0447f6f4d4a6f6a7b09c4639 24-Sep-2010 Douglas Gregor <dgregor@apple.com> Synchronize globally-cached code completion results with the results
provided when the optimization is disabled. In particular, split
the completion context CCC_Other into two contexts: CCC_Other, which
means that it's an undisclosed context for which any other results are
unwelcome, and CCC_Recovery, which is used in recovery cases.

Since we're now using the completion context within the completion
results builder, make sure that it's always set to something.

Fixes <rdar://problem/8470644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b05496dbd63f03bf474dae2c4d1e2142608780cc 20-Sep-2010 Douglas Gregor <dgregor@apple.com> Tweak priorities for some types and macros:
- In Objective-C, we prefer BOOL to bool for historic reasons;
slightly penalize "bool".
- Treat Nil macro as a NULL pointer constant.
- Treat YES, NO, true, and false macros as constants.
- Treat the bool macro as a type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114356 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0268810a46780144a2d5fb5a017c938d1199189c 15-Sep-2010 Douglas Gregor <dgregor@apple.com> Introduce a new code-completion context for a parenthesized
expression, e.g., after the '(' that could also be a type cast. Here,
we provide types as code-completion results in C/Objective-C (C++
already had them), although we wouldn't in a normal expression context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
424668cc90a07f3f98b36dad252940a43ded83d8 11-Sep-2010 Douglas Gregor <dgregor@apple.com> The two libclang crash-recovery tests that involve precompiled
preambles end up leaving the precompiled preambles around. This is by
design, since we do minimal cleanup during crash recovery. However,
it's unfortunate for testing, so introduce a hook that allows these
two tests to put the precompiled preamble somewhere where we can
delete them after testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
2cd4fd4b7554480cbea67b48de5e5d467d06e292 11-Sep-2010 Douglas Gregor <dgregor@apple.com> If we fail to create a temporary file for the precompiled preamble,
just abort creation of the precompiled preamble rather than doing
silly things. This is the second part of the fix for the weird
preamble-related failures on Windows. Big thanks to Francois Pichet
for the great detective work!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c6cb2b02f0f4b3f162985803df3729b4def32108 11-Sep-2010 Douglas Gregor <dgregor@apple.com> Tweak GetPreamblePCHPath() to more closely match the behavior of the
Windows GetTempPath() function, and be sure to create the directory in
which the precompiled preamble will reside before creating the
temporary file itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1a480c403a3b141ab89c9c59cf7b681102a1bfab 27-Aug-2010 Douglas Gregor <dgregor@apple.com> Suggest "const" and "volatile" code completions after a function
declarator, the very definition of "low-hanging fruit".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
458433d2f0f5c96a9e0d21decdd44bebccf20b11 26-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement code completion for @selector expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1e5e6684b0f27701e6f7c65f8c6a32a10cbcc3ed 26-Aug-2010 Douglas Gregor <dgregor@apple.com> Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

3rd try. How embarrassing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1cb237fbf9e52e17f1e03b6f80c1114f47f93781 26-Aug-2010 Daniel Dunbar <daniel@zuster.org> Revert r112149, "Move the sorting of code-completion results out of the main
path and ...", it is failing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
be13afea6d9a5dc8877d5553552bd07c733a99bf 26-Aug-2010 Douglas Gregor <dgregor@apple.com> Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
9214819c7d4b24fd1b38480d845d8e345d8f0196 26-Aug-2010 Douglas Gregor <dgregor@apple.com> Revert "Move the sorting of code-completion results out of the main path and
into the clients", because the C standard library sucks. Where's my
stable sort, huh?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c7ed372ec7b1c9be05d022e9bc23cd8641f2b28b 26-Aug-2010 Douglas Gregor <dgregor@apple.com> Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
721f359a350059a81945baa08f63b2e5feceb044 25-Aug-2010 Douglas Gregor <dgregor@apple.com> When combining the code-completion results from Sema long with the
code-completion results cached by ASTUnit, sort the resulting result
set. This makes testing far, far easier, so this commit also includes
tests for the previous few fixes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
59a66946aa7723c7b14831aa50902d533baaa957 25-Aug-2010 Douglas Gregor <dgregor@apple.com> Add a missing case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c9c29a8d7a0f78ddf2b393dd92f77c7f2046179c 25-Aug-2010 Douglas Gregor <dgregor@apple.com> Fix an off-by-one error when computing the precompiled preamble for
code completion. We were allowing the preamble to include the line
that we're code-completing on. Again, testcase is forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4125c37c71c6c8475019497de837204f0ee4370f 25-Aug-2010 Douglas Gregor <dgregor@apple.com> Make the cursor kind of macro-name-only completions produced by
ASTUnit match those produced directly by code completion. Test case is
forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0a2c5e256abb4dc031c21fe4dc92c4f3afe9947c 25-Aug-2010 John McCall <rjmccall@apple.com> Teach Sema to live without CodeCompleteConsumer.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112028 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f29c5233085a5af795c3c01b94d319e5b3235d56 25-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement code completion for preprocessor expressions and in macro
arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1fbb447e9d43c2c676e94081fbfee7eb6cbe933b 24-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement preprocessor code completion where a macro name is expected,
e.g., after #ifdef/#ifndef or #undef, or inside a defined <macroname>
expression in a preprocessor conditional.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111954 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
58ddb60f409125eda5436c4a1f070f7fa4744295 24-Aug-2010 Douglas Gregor <dgregor@apple.com> Introduce new libclang API functions that determine the availability
of a cursor or code-completion result, e.g., whether that result
refers to an unavailable, deleted, or deprecated declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
6d72cbedbab7eea947f34ddc6a44c3b308530034 23-Aug-2010 Douglas Gregor <dgregor@apple.com> Don't include macro results when we're completing a declarator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
2ccccb3ff40c64927817a7e1ddf1da8c188ed224 23-Aug-2010 Douglas Gregor <dgregor@apple.com> Introduce a new code-completion point when we're parsing a
declarator. Here, we can only see a few things (e.g., cvr-qualifiers,
nested name specifiers) and we do not want to provide other non-macro
completions. Previously, we would end up in recovery mode and would
provide a large number of non-relevant completions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111818 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
875ab10245d3bf37252dd822aa1616bb0a391095 22-Aug-2010 John McCall <rjmccall@apple.com> Abstract out member-pointer creation. I'm really unhappy about the current
duplication between the constant and non-constant paths in all of this.

Implement ARM ABI semantics for member pointer constants and conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
2283d79155a3e82442fce124ce5fd704ca138801 20-Aug-2010 Douglas Gregor <dgregor@apple.com> When performing code-completion in the presence of a preamble, make
sure to (1) actually use the remapped files we were given rather
than old data, and (2) keep the remapped files alive until the
code-completion results are destroyed. Big thanks to Daniel for the
test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f128fed9c2ae16d3d6d8b8580b7a257e5c0a7754 20-Aug-2010 Douglas Gregor <dgregor@apple.com> When we decide not to reuse a precompiled preamble, clear out the
previous precompiled preamble completely. Fixes <rdar://problem/8330950>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c1cf1586f7bbdf8a955a3be79309834ebc25c3af 19-Aug-2010 Daniel Dunbar <daniel@zuster.org> Fix a loop overrun in ComputePreamble when the last remapped file was erased,
and reenable crash recovery test.
- Reparsing is still very crashy / weird, so I had to sprinkle random code into
the remapped input to get it to do what I want (i.e., crash!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
671947b18dba342f9aba022ee992babef325a833 19-Aug-2010 Douglas Gregor <dgregor@apple.com> Plug a leak when precompiling the preamble in ASTUnit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8b1540c159093e0e627ebf6542d0c0b7aba99eaf 19-Aug-2010 Douglas Gregor <dgregor@apple.com> Make sure to initialize ASTUnit::UnsafeToFree

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
571db7f0cb31789737be92fce1c1b738e6dbe795 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename various classes from PCH to AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.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/Frontend/ASTUnit.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/Frontend/ASTUnit.cpp
a4232eb646d89e7d52424bb42eb87d9061f39e63 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Rename PCHWriter to ASTWriter

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f421089b73800066bbf43613c9a8422a96c1b0c3 19-Aug-2010 Douglas Gregor <dgregor@apple.com> When creating an ASTUnit by parsing source code, set DisableFree to
false (not true), so that the CompilerInstance will actually free data
structures when it's done. This fixes a major leak with libclang's
in-process code completion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bdbb004f38978da0c4a75af3294d1c7b5ff84af1 19-Aug-2010 Douglas Gregor <dgregor@apple.com> Simplify the ownership model for DiagnosticClients, which was really
convoluted and a bit leaky. Now, the Diagnostic object owns its
DiagnosticClient.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
857281328fa824782bdd979c3bfdd97ecdbc1609 17-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Reintroduce the serialization library, with fixed dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4557e473c9e673e7e6f7063478f63a5b3c6c10b2 17-Aug-2010 Douglas Gregor <dgregor@apple.com> Revert Sebastian's build-breaking patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
93c972945bccd1a966b0445f9ed45db433b77bc1 17-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Create a new Serialization module that contains all the PCH code, and will contain all the module code in the future. Update the Makefiles, CMake projects and the Xcode project. I hope I did everything right for Xcode. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
727d93ef49e18147149354fadd10e86b13bc4ab0 17-Aug-2010 Douglas Gregor <dgregor@apple.com> When the # of top-level declarations changes after reparsing a
translation unit, refresh code-completion results because they've
probably changed. However, enforce a cooldown period between
refreshes, to avoid thrashing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
349d38cef04ddf8938047c1b542a799aa82dfe84 17-Aug-2010 Douglas Gregor <dgregor@apple.com> Move include to the proper place. No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
a5fb7c3b56c3698e19a7c1e97d41150de33cf6c9 17-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement support for cached code completions for
nested-name-specifiers. Also includes fixes to the generation of
nested-name-specifier result in the non-cached case; we were producing
lame results for namespaces and namespace aliases, which (1) didn't
always have nested-name-specifiers when we want them, and (2) did not
have the necessary "::" as part of the completion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
5535d5721b6bfb5df9583bc0632da910a176109d 16-Aug-2010 Douglas Gregor <dgregor@apple.com> Formatting fixes. No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
5f808c2bfe2f95c984029d76deb4aaebcad30cbc 16-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement name hiding of cached global code-completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111184 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
697ca6dc944fd1233a6f07f0777807fbab6a31c1 16-Aug-2010 Douglas Gregor <dgregor@apple.com> Move some code out-of-line which has long since grown too large to be
inlined. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f5586f6b311c98e1022a8fe0609053849b70d323 16-Aug-2010 Douglas Gregor <dgregor@apple.com> When caching code completions for global declarations, keep track of
the usage type of each declaration result, then compare those types to
the preferred type of the completion. This provides parity in the
priority calculation between the code-completion results produced
directly from Sema and those cached by ASTUnit.

For the standard Cocoa.h (+ others) example, there's a penalty of 3-4
hundredeths of a second when caching the global results (for ~31,000
results), because we need an ASTContext-agnostic representation of
types for the comparison, and therefore we use... strings. Eventually,
we'd like to implement a more efficient ASTContext-agnostic encoding
of types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c4421e966d77a18f815284175b3fcbb46f36fa39 16-Aug-2010 Douglas Gregor <dgregor@apple.com> Dereferencing NULL pointers is such poor form.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1827e10051638770ad9ccf3e285caf95f995afd1 16-Aug-2010 Douglas Gregor <dgregor@apple.com> When caching global completion results, keep track of the simplified
type class, so that we can adjust priorities appropriately when the
preferred type for the context and the actual type of the completion
are similar.

This gets us one step closer to parity of the cached completion
results with the non-cached completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1395c5d00588a9c3154683ffe6c223bb7af2fbf2 15-Aug-2010 Benjamin Kramer <benny.kra@googlemail.com> Open AST/PCH files in binary mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8071e4212ae08f8014e0c3ae6d18b7388003a5cc 15-Aug-2010 Douglas Gregor <dgregor@apple.com> Extend the code-completion caching infrastructure to include global
declarations (in addition to macros). Each kind of declaration maps to
a certain set of completion contexts, and the ASTUnit completion logic
introduces the completion strings for those declarations if the actual
code-completion occurs in one of the contexts where it matters.

There are a few new code-completion-context kinds. Without these,
certain completions (e.g., after "using namespace") would need to
suppress all global completions, which would be unfortunate.

Note that we don't get the priorities right for global completions,
because we don't have enough type information. We'll need a way to
compare types in an ASTContext-agnostic way before this can be
implemented.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
87c08a5d6b9e1e44ae6f554df40139d3a6f60b33 14-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement caching of code-completion results for macro definitions
when the CXTranslationUnit_CacheCompletionResults option is given to
clang_parseTranslationUnit(). Essentially, we compute code-completion
results for macro definitions after we have parsed the file, then
store an ASTContext-agnostic version of those results (completion
string, cursor kind, priority, and active contexts) in the
ASTUnit. When performing code completion in that ASTUnit, we splice
the macro definition results into the results provided by the actual
code-completion (which has had macros turned off) before libclang gets
those results. We use completion context information to only splice in
those results that make sense for that context.

With a completion involving all of the macros from Cocoa.h and a few other
system libraries (totally ~8500 macro definitions) living in a
precompiled header, we get about a 9% performance improvement from
code completion, since we no longer have to deserialize all of the
macro definitions from the precompiled header.

Note that macro definitions are merely the canary; the cache is
designed to also support other top-level declarations, which should be
a bigger performance win. That optimization will be next.

Note also that there is no mechanism for determining when to throw
away the cache and recompute its contents.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7ae2faafd30524ef5f863bb3b8701977888839bb 13-Aug-2010 Douglas Gregor <dgregor@apple.com> Implement clang_saveTranslationUnit(), which saves a translation unit
into a PCH/AST file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
914ed9d30e9abf829a62aa996b083b1e47c19ff6 13-Aug-2010 Douglas Gregor <dgregor@apple.com> Teach ASTUnit to hold on to the Sema object and ASTConsumer that are
used when parsing (or re-parsing) a file. Also, when loading a
precompiled header into ASTUnit, create a Sema object that holds onto
semantic-analysis information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
27372b4f1f402e95dd479ecf40c39ca71c15619f 11-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Reintroduce the ASTConsumer/ASTUnit fix from r110610, it has nothing to do with the breakage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
6bf1830875673d6bd6c5bfcd65c9dcabfb45958b 11-Aug-2010 Douglas Gregor <dgregor@apple.com> Fix a thinko in the creation of temporary files for the precompiled preamble

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
deacbdca554298ccdf636f19c6094a8825ec6b34 11-Aug-2010 Douglas Gregor <dgregor@apple.com> Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,
and create separate decl nodes for forward declarations and the
definition," which appears to be causing significant Objective-C
breakage.


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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
df95a13ec73d2cdaea79555cb412d767f4963120 09-Aug-2010 Douglas Gregor <dgregor@apple.com> Use precompiled preambles for in-process code completion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f65339e0f1b9ccfc0c92c85f68bb2e72ea48a27b 06-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Add an environment variable that makes libclang use chaining for PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110414 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cee235cdf0b8047761ffac598c4c3a32ab7411a2 05-Aug-2010 Douglas Gregor <dgregor@apple.com> Give clang_codeCompleteAt() an "options" parameter, and add a new
flags enumeration + default-generating function that allows
code-completion to be customized via the libclang API.

Plus, turn on spell-checking when performing code completion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b75d3dfa4ca6531858b8132eb4db7260408671cf 04-Aug-2010 Douglas Gregor <dgregor@apple.com> When performing in-process code completion, don't free the remapped
file buffers until the code completion results are destroyed;
diagnostics may end up referring into the source.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110216 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548 04-Aug-2010 Douglas Gregor <dgregor@apple.com> Add code-completion support directly to ASTUnit, which performs code
completion within the translation unit using the same command-line
arguments for parsing the translation unit. Eventually, we'll reuse
the precompiled preamble to improve code-completion performance, and
this also gives us a place to cache results.

Expose this function via the new libclang function
clang_codeCompleteAt(), which performs the code completion within a
CXTranslationUnit. The completion occurs in-process
(clang_codeCompletion() runs code completion out-of-process).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
eababfbddb74d186f78783a9731a78ad371c9800 04-Aug-2010 Douglas Gregor <dgregor@apple.com> When we try (but fail) to build a precompiled preamble, wait for a
short "cooling off" period (defaulting to 5 reparses) before trying to
build a precompiled preamble again. Previously, if we failed to build
the precompiled preamble at any time, we just gave up the whole
charade any never tried again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
eb8837b88c18631c69ac75f64ab1853762063180 03-Aug-2010 Douglas Gregor <dgregor@apple.com> When using a precompiled preamble, keep track of the top-level
declarations that we saw when creating the precompiled preamble, and
provide those declarations in addition to the declarations parsed in
the main source file when traversing top-level declarations. This
makes the use of precompiled preambles a pure optimization, rather
than changing the semantics of the parsed translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1d715ac14bf440664fb0d1425ea882274f994f57 03-Aug-2010 Douglas Gregor <dgregor@apple.com> Reshuffle the PCH generator action and consumer, so that we can re-use
it while generating precompiled preambles. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110108 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c0659ec614c428c7d15746fcad15d50a2703751d 02-Aug-2010 Douglas Gregor <dgregor@apple.com> When using a precompiled preamble, save the diagnostics produced when
creating the preamble and "replay" them when reusing the
preamble. Also, fix a thinko in the copying of the preamble when
building the precompiled preamble.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cc5888d833caf90ebda37f24da40d2cd06b4d820 31-Jul-2010 Douglas Gregor <dgregor@apple.com> Implement dependency analysis for the precompiled preamble. If any of
the files in the precompiled preamble have changed since it was build,
force the preamble to be rebuilt.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109937 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
385103b79c5338a2be5da0ca70652400bc267371 30-Jul-2010 Douglas Gregor <dgregor@apple.com> Add some timers to ASTUnit that are only enabled when the LIBCLANG_TIMING environment variable is set.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
fd0b87006b478bb573d369385aed64a58225264d 29-Jul-2010 Douglas Gregor <dgregor@apple.com> Turn off precompiled preamble support for C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
28233428da1ebec20c893d6297ae3191318940dd 27-Jul-2010 Douglas Gregor <dgregor@apple.com> Fix use-after-free with precompiled preambles

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109505 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
fae3b2f4743dad616623c4df2fdb0f5128bd36d9 27-Jul-2010 Douglas Gregor <dgregor@apple.com> Implement -fno-validate-pch at the -cc1 level, which suppresses most
of the usual consistency checks used to determine when a precompiled
header is incompatible with the translation unit it's being loaded
into.

Enable this option when loading a precompiled preamble, because the
preamble loader will be performing all of this checking itself. Enable
the preamble-based test now that it's working.

This option is also useful for debugging Clang's PCH
(<rdar://problem/7532213>).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f4f6c9db68465b886ec2e596feaa6ecc782395a4 26-Jul-2010 Douglas Gregor <dgregor@apple.com> Introduce basic support for loading a precompiled preamble while
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.

It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).

As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.



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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
592508ed997e52207cf380f9b6eb9943994ad7ae 24-Jul-2010 Douglas Gregor <dgregor@apple.com> Put a newline at the end of the padded buffers used for the
precompiled preamble. This will suppress the -pedantic "no newline at
end of file" warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
754f3490c5b0f5d83361f001bc87944f23644abb 24-Jul-2010 Douglas Gregor <dgregor@apple.com> Once we've built (or reused) a precompiled preamble, create the
appropriately-padded main file buffer (that has spaces in the extra
"reserved" space) and thread that buffer through to the parsing
function. This still does nothing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
175c4a9aa61f4449f27b729737e4438684ac6d92 24-Jul-2010 Douglas Gregor <dgregor@apple.com> Once we've built a precompiled preamble, keep track of the details of
that preamble (the preamble text, preamble file, reserved main file
size). Check these details when we try to rebuild the precompiled
preamble, and when nothing has changed, re-use the precompiled
preamble.

This code is still very much a WIP, and can't even properly be tested
because we have no way to use the precompiled preamble yet. "Trust me"



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
ad23ebe22b7e52e3875981eeb46a1fd61a7554fb 23-Jul-2010 Zhongxing Xu <xuzhongxing@gmail.com> Fix build on Ubuntu 10.04.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
44c181aec37789f25f6c15543c164416f72e562a 23-Jul-2010 Douglas Gregor <dgregor@apple.com> Basic plumbing for generating a precompiled preamble for an
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109202 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
abc563f554951259bbe0315055cad92ee14d87e4 19-Jul-2010 Douglas Gregor <dgregor@apple.com> Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0bbad519aa068206f1e158d5073f72a39fbe83c5 19-Jul-2010 Daniel Dunbar <daniel@zuster.org> Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
- Fixes a problem where the Clang executable path was not initialized properly
on Win32, because sys::Path::getBasename() doesn't do what I always think it
does. Imagine that, a sys::Path interface that is confusing!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cb481aacdc0f08e225c68c99c65351b367042475 15-Jul-2010 Sebastian Redl <sebastian.redl@getdesigned.at> There is another implementation of PCHReaderListener around. Update it to the new interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
98b7c5c496dfccb39287b8f7d8f1444594936d10 11-Jun-2010 Charles Davis <cdavis@mines.edu> Add an option to specify the target C++ ABI to the frontend. Use it to
select either the default Itanium ABI or the new, experimental Microsoft ABI.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
faddc3e53a95c68f2c3a966e0f1e6eba110dafd6 08-Jun-2010 Daniel Dunbar <daniel@zuster.org> Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
2056048f0f619adadc9a5416a2c4cdf95c58eef7 08-Jun-2010 Daniel Dunbar <daniel@zuster.org> Frontend: Move some initialization from CompilerInstance to FrontendAction, to parallel what is done for AST inputs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d3598a65716e120aef45aa2841d730e03f7101fe 08-Jun-2010 Daniel Dunbar <daniel@zuster.org> Frontend: Change FrontendAction::BeginSourceFile to take the input kind instead of an IsAST bool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c34ce3fa613d5e4a283e53615fceafd17390445b 08-Jun-2010 Daniel Dunbar <daniel@zuster.org> Frontend: Lift InputKind enumeration to top level.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
da5a428bf3db404fe3c91b689cd87c68789d6db9 03-May-2010 Ted Kremenek <kremenek@apple.com> Workaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since they don't go in
the DeclContext for the translation unit. This is to workaround a fundamental issue in how
ObjC decls (within an @implementation) are parsed before the ObjCContainerDecl is available.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102944 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cb421fa690da545b58a720abe5f1c49b166dbde7 19-Apr-2010 Dan Gohman <gohman@apple.com> Fix -Wcast-qual warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101786 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
28019772db70d4547be05a042eb950bc910f134f 06-Apr-2010 Douglas Gregor <dgregor@apple.com> Make Diagnostic reference-counted, which is simpler than juggling
maybe-ownership vs. ownership.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3687e9d3a5dbfa9963af02a49a2b139d91310813 05-Apr-2010 Douglas Gregor <dgregor@apple.com> Clarify the ownership semantics of the Diagnostic object used by
ASTUnit. Previously, we would end up with use-after-free errors
because the Diagnostic object would be creating in one place (say,
CIndex) and its ownership would not be transferred into the
ASTUnit. Fixes <rdar://problem/7818608>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
405634b215f19eec7183bd8005e34aa5a02f64a1 05-Apr-2010 Douglas Gregor <dgregor@apple.com> Minor ASTUnit cleanups:
- Rename "Diagnostics" and related to "StoredDiagnostics", to better
capture what we're actually storing.
- Move SourceManager and FileManager to the heap.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
5d93ed3c7a2dae0a8f422747e269963b3ef11d95 01-Apr-2010 Daniel Dunbar <daniel@zuster.org> Driver: Add support for a CLANGXX_IS_PRODUCTION build variable, which enable
Clang++ support, even in "Production" mode (for testing purposes).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100119 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
94dc8f640ebea52241412512ed48601626edbc58 19-Mar-2010 Douglas Gregor <dgregor@apple.com> Optionally store a PreprocessingRecord in the preprocessor itself, and
tie its creation to a CC1 flag -detailed-preprocessing-record.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4ae8f298b1ea51b4c2234f9148e2e4349c9bdd23 18-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce the notion of a "preprocessing record", which keeps track of
the macro definitions and macro instantiations that are found
during preprocessing. Preprocessing records are *not* generated by
default; rather, we provide a PPCallbacks subclass that hooks into the
existing callback mechanism to record this activity.

The only client of preprocessing records is CIndex, which keeps track
of macro definitions and instantations so that they can be exposed via
cursors. At present, only token annotation uses these facilities, and
only for macro instantiations; both will change in the near
future. However, with this change, token annotation properly annotates
macro instantiations that do not produce any tokens and instantiations
of macros that are later undef'd, improving our consistency.

Preprocessing directives that are not macro definitions are still
handled by clang_annotateTokens() via re-lexing, so that we don't have
to track every preprocessing directive in the preprocessing record.

Performance impact of preprocessing records is still TBD, although it
is limited to CIndex and therefore out of the path of the main compiler.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98836 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
19b43e1ba9324cb08b730fa38d9be865e63771a2 17-Mar-2010 Douglas Gregor <dgregor@apple.com> Don't "take" the file manager and source manager when
ASTUnit::LoadFromCompilerInvocation() fails to create target
information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
ec1afbfd8e880d0169aab0ececa2e7e1611f4955 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Make sure we actually override ReadHeaderFileInfo when we meant to

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
667514d92afd1485765cb4e2bbe452883adc989b 05-Mar-2010 Douglas Gregor <dgregor@apple.com> The Windows build is just too weird; there's no real cost to doing the concurrency checks for ASTUnit in all builds

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
12312b807e7c00504c2e5b3b5e2d11bfbca4b8d8 05-Mar-2010 Douglas Gregor <dgregor@apple.com> Switch from NDEBUG to _DEBUG, since our Windows build is funny

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bdf6062bc10aa3b73b16402b440b8073310acd06 05-Mar-2010 Douglas Gregor <dgregor@apple.com> A little hack to identify unwanted concurrency in CIndex

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c8dfe5ece04e683106eb96c58a2999f70b53ac21 27-Feb-2010 Douglas Gregor <dgregor@apple.com> When given unsaved files in clang_createTranslationUnitFromSourceFile,
copy the source buffers provided rather than referencing them
directly, so that the caller can free those buffers immediately after
calling clang_createTranslationUnitFromSourceFile(). Otherwise, we
risk hitting those buffers later (when building source ranges, forming
diagnostics, etc.).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
313e26c4e81f0e467490a530548450f4c824a6c4 19-Feb-2010 Douglas Gregor <dgregor@apple.com> Teach ASTUnit to keep track of temporary files, then delete them when
the ASTUnit itself is destroyed. Fixes <rdar://problem/7649385>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
a88084b78fd4ca5d3d858c14b02414f8cc399f02 18-Feb-2010 Douglas Gregor <dgregor@apple.com> Rework how CIndex handles diagnostics. Rather than using a callback,
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.

To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.

I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
b26d483a9f7fdc815e87bbbac4af916307b4c07d 16-Feb-2010 Daniel Dunbar <daniel@zuster.org> ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support this as an argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f7acc37450d59ef751df73acb91de73850cc6517 16-Feb-2010 Daniel Dunbar <daniel@zuster.org> ASTUnit::LoadFromCompilerInvocation - Take ownership of the provided invocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
807b06157a1a5c050520fc194d32f16d22d423a8 30-Jan-2010 Daniel Dunbar <daniel@zuster.org> ASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine is
live as long as the ASTUnit. This is useful for clients which want to maintain
pointers to the LangOptions object which ultimately lives in the
CompilerInvocation, although it would be nice to make all of this ownership
stuff more explicit and obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7297c18c843138625a61e01a137664a176739683 30-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> PCHReader doesn't implement classof so dyn_casting it will do really weird stuff. Use a static_cast instead.

I don't know if this hack is the right fix. Doug, please take a look.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
3bd54cc56276c386f4d50940a9fbfcad7a69cb75 25-Jan-2010 Daniel Dunbar <daniel@zuster.org> ASTUnit: Don't check that input files exist when parsing ASTs from the command
line -- they may be remapped (fake) files. This is useful for testing parsing
entirely from memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4db64a461cb3442934afe43c83ed3f17f7c11c1d 23-Jan-2010 Douglas Gregor <dgregor@apple.com> Extend clang_createTranslationUnitFromSourceFile() to support creating
translation units that include unsaved files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
8b9adfea5e834eaee0f45d8cc7fb052d68df4a46 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Add -resource-dir to clang -cc1, this allows the base directory for compiler
resources (e.g., /usr/lib/clang/1.1) to be passed on the command line instead of
computed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91370 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
869824e87940f97b87064db2df2861e82e08a8c6 13-Dec-2009 Daniel Dunbar <daniel@zuster.org> Lift builtin-include-path logic out of ASTUnit::LoadFromCommandLine and fix CIndex to pass in the right directory (previously it was using the path to the main executable, which generally is wrong).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
1e69fe3a9f0a42b32a3000bda51677d51416564e 13-Dec-2009 Daniel Dunbar <daniel@zuster.org> CompilerInvocation: Move builtin-include-path logic out of CompilerInvocation::CreateFromArgs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e3fdca2ee0346a41d9cc5ee417a75e66274216f5 08-Dec-2009 Jeffrey Yasskin <jyasskin@google.com> Remove several .c_str() to be forward-compatible with StringRef.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
f772d1e2a5688572d07f42896a50ac57a4a41fe8 04-Dec-2009 Daniel Dunbar <daniel@zuster.org> ASTUnit/CIndex: Explicitly track the top-level decls when using an ASTUnit made
from a source file.
- This allows CIndex to avoid iterating over all the top-level decls when using
a PCH, which means we deserialize far fewer decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
5262fda30b876c8aae95f2eb92e349418d6b14bb 03-Dec-2009 Daniel Dunbar <daniel@zuster.org> Fix ASTUnit to allows require a (persistent) Diagnostic object be provided; propogate and simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
c7822dbf3c01a2a5f837cff82ba7889ea755daca 02-Dec-2009 Daniel Dunbar <daniel@zuster.org> ASTUnit: Explicitly track whether the ASTUnit came from an actual AST or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
68ea2ac7fd98a5a44c7a5b04c54076cf794531cb 02-Dec-2009 Daniel Dunbar <daniel@zuster.org> ASTUnit: Fix initialization of OnlyLocalDecls variable, and honor UseBumpAllocator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
68d40e2d16b9fadba386853d6bbb60089291fdc5 02-Dec-2009 Daniel Dunbar <daniel@zuster.org> Fix ASTUnit::getOriginalSourceFileName() when using ASTUnit's derived from
source files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cb6dda1a7abe2fe30b0345bfbbf872cc73446678 02-Dec-2009 Daniel Dunbar <daniel@zuster.org> ASTUnit: Don't create an LLVMContext, it shouldn't be needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7b55668db7618334cc40011d3c1e128524d89462 02-Dec-2009 Daniel Dunbar <daniel@zuster.org> Add ASTUnit::LoadFromCommandLine, which creates an ASTUnit out of a list of
(clang/driver) command line arguments (including the source file).
- The arguments are expected to include the source file.

- The idea is that even though this is a somewhat odd API, its the form which
many tools can most easily use (for example, by interposing with the compiler).

Also, switch index-test's -ast-from-source to use this entry point, and provide
a -arg command line argument which can be used to test that the command line
arguments are handled correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
64a32baec6fdc7e5fbcba417a2754f78ab876245 01-Dec-2009 Daniel Dunbar <daniel@zuster.org> ASTUnit: Make sure to preserve the TargetInfo for later use.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
521bf9c529e653ab28896d027352d3e16e2672d5 01-Dec-2009 Daniel Dunbar <daniel@zuster.org> Add ASTUnit::LoadFromCompilerInvocation, which does what it says.

Also, add an -ast-from-source option to index-test which allows index-test to
run on source files directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bd21828179a61bd0954b082825cfb8a93345f602 28-Nov-2009 Benjamin Kramer <benny.kra@googlemail.com> Remove VISIBILITY_HIDDEN from anonymous namespaces in libFrontend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90033 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0 15-Nov-2009 Daniel Dunbar <daniel@zuster.org> Add TargetOptions and use it when constructing targets.
- This ended up being hard to factor, sorry for the large diff.

- Some post-commit cleanup to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88833 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7b5a1210d93ca62ecd61800f245c87259b1f8f79 11-Nov-2009 Daniel Dunbar <daniel@zuster.org> Redo how PCH handles its implicit include. Instead of treating this specially in
the front-end (as far as the preprocessor goes), follow the usual logic of
inserting the (original include path) name into the predefines buffer. This
pushes the responsibility for handling this to PCH instead of the front-end. In
PCH this requires being a little more clever when we diff the predefines
buffers.

Neither of these solutions are particularly great, I think what we eventually
should do is something like gcc where we insert a special marker to indicate the
PCH file, but then run the preprocessor as usual. This would be clearer and
would allow us to drop the overly clever predefines handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86806 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
dc3c0d20375bda7775b2fade05b20e315798b9fe 11-Nov-2009 Daniel Dunbar <daniel@zuster.org> StringRefify some PCH interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
fc0622155fa61349698a8fd0053773c37d9f7ac4 19-Oct-2009 Ted Kremenek <kremenek@apple.com> The constructor for ASTUnit now takes a DiagnosticClient*, allowing uses of ASTUnit to specify
alternate DiagnosticClients. To match this API, ASTUnit::LoadFromPCHFile() now takes a corresponding
DiagnosticClient* argument as well. The DiagnosticClient object is destroyed when the ASTUnit object
is destroyed.

The CIndex library now uses this API to create a 'IgnoreDiagnosticsClient' that simply silences
diagnostics when using the clang_createTranslationUnitFromSourceFile() function. This fixes
<rdar://problem/7312058>. This API can change in the future as we add more flexibility for clients.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
36c4464ba6cfc2a63dc67c493ef2f5ab2aea09cc 19-Oct-2009 Steve Naroff <snaroff@apple.com> Move Diagnostic/DiagClient/FileManager from Indexer => ASTUnit.

Removing this shared data should enable clang_createTranslationUnit/clang_createTranslationUnitFromSourceFile to be run from multiple threads (related to <rdar://problem/7303432>).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4a630d30cd8ee9c8f46b8d3c9ad7e7e00d393f32 18-Oct-2009 Benjamin Kramer <benny.kra@googlemail.com> Use sys::Path::eraseFromDisk instead of unlink as suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
5cf48766d626ff6b223acc9d4b7e415ca8480836 17-Oct-2009 Ted Kremenek <kremenek@apple.com> Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the created ASTContext to use
its own BumpPtrAllocator to allocate ASTs.

Change clang_createTranslationUnit (CIndex) to pass 'UseBumpPtrAllocator = true' to
ASTUnit::LoadFromPCHFile().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
7d1d49d2971b20a97b3c2a301470b9eaaa130137 16-Oct-2009 Douglas Gregor <dgregor@apple.com> Keep track of whether declararions were loaded from a precompiled
header or not via a new "PCHLevel" field in Decl. We currently use
this information to help CIndex filter out declarations that came from
a precompiled header (rather than from an AST file). Further down the
road, it can be used to help implement multi-level precompiled
headers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
e19944c93961b7618f4f3f3185f698f46369ea54 16-Oct-2009 Steve Naroff <snaroff@apple.com> Make sure temporary files get unlinked.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
d5b6126389e1e2fd89e498fe17da4bb44ece0302 21-Sep-2009 Daniel Dunbar <daniel@zuster.org> Change ASTUnit to only initialize the predefines buffer to the suggested predefines.
- It isn't really clear what to do with the preprocessor here, but this is more sensible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
31b87d8006d4863dd9b17e515ac720941efc38e3 21-Sep-2009 Daniel Dunbar <daniel@zuster.org> Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
9efa767be8e9f2dae509d3a0be93ade01bfa1560 04-Sep-2009 Steve Naroff <snaroff@apple.com> Implement accessors clang_getCursorKind(), clang_getCursorDecl().
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
77accc11f04ed4ff9afd4e27d430144d4714be56 03-Sep-2009 Steve Naroff <snaroff@apple.com> Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bce6f62ae7d2c15992617f64e30067803fb5b47f 03-Sep-2009 Daniel Dunbar <daniel@zuster.org> Revert "Visit function/method bodies and issue callback for parameters and local
variables.", this is breaking x86_64-apple-darwin10 and Linux tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
cc318939daaa50fc07f7d431caec3c8679893e9c 03-Sep-2009 Daniel Dunbar <daniel@zuster.org> Revert "Remove redundant local variable (use newly created instance data).", the
previous commit this depends on is breaking x86_64-apple-darwin10 and Linux tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
bbff6990ac96c1767cdbe66d439fc6ba5d3fa693 03-Sep-2009 Steve Naroff <snaroff@apple.com> Remove redundant local variable (use newly created instance data).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
23d8bea7056e7f474ce7f42042021a148feee8f7 03-Sep-2009 Steve Naroff <snaroff@apple.com> Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
106c9981f18084e60602244f1feaeabbbe8ab5e8 25-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Handle PCHReader::IgnorePCH, it gets returned for when the file does not exist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
4b562cf889bc59e1914dd2c5d9fbd7e7bfa1ad77 20-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add the license part to the new source files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73825 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Frontend/ASTUnit.cpp
0853a02c3b04d96a3c432b883e403175c954cd81 20-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce the ASTUnit class.

ASTUnit is a helper class to allow easy loading of an ASTContext from a PCH file. No users for now.

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