History log of /external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

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

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Lex/Preprocessor.cpp
a5ba7b405dff48a5a0a63fff32c99eedb044842b 07-Nov-2013 Douglas Gregor <dgregor@apple.com> Modules: Teach the preprocessor to recognize 'import' only after an '@'.

The preprocessor currently recognizes module declarations to load a
module based on seeing the 'import' keyword followed by an
identifier. This sequence is fairly unlikely in C (one would need a
type named 'import'), but is more common in Objective-C (where a
variable named 'import' can cause problems). Since import declarations
currently require a leading '@', recognize that in the preprocessor as
well. Fixes <rdar://problem/15084587>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
d2f9308220af22bfc1bcd3bc2cad118dbd8be013 19-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Make Preprocessor::Lex non-recursive.

Before this patch, Lex() would recurse whenever the current lexer changed (e.g.
upon entry into a macro). This patch turns the recursion into a loop: the
various lex routines now don't return a token when the current lexer changes,
and at the top level Preprocessor::Lex() now loops until it finds a token.
Normally, the recursion wouldn't end up being very deep, but the recursion depth
can explode in edge cases like a bunch of consecutive macros which expand to
nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this
patch).

<rdar://problem/14569770>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
056ec12ca14ee5014ea49786f719ceaa299a7e19 05-Aug-2013 Daniel Jasper <djasper@google.com> Add option to disable module loading.

This patch was created by Lawrence Crowl and reviewed in:
http://llvm-reviews.chandlerc.com/D963

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
dd08a0c178329ec16cb9e494e6880f3991708b93 04-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs object that provides information about
the argument tokens for a function macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3e25b990f1e2ba2a9a63dde5fd111492a7f6194a 30-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Fix memory leak related to deserialized MacroInfo objects.

Deserialized MacroInfos were not destroyed and if their SmallVector did heap allocation,
it was leaked.

rdar://13768967

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
d560ce3b66325ff22cd3aca23c6de3143bd74d24 27-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Preprocessor] Remove PPMutationListener.

It's not used anymore.

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

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

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

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

(A MacroDirective always points to a MacroInfo object.)

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

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
95d912c994832333a998bc7d4ae0e8e830a2d38b 01-Feb-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce SourceManager::PredefinesFileID, to allow each checking of whether
a source location came from the predefines buffer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
98b21b9fcef25fc6953ce36b4c71ca2c02999f1d 31-Jan-2013 Jordan Rose <jordan_rose@apple.com> Preprocessor: initialize member introduced in r173881.

Compilation always sets this explicitly, but creating a preprocessor
manually should still put the 'IsPreprocessedOutput' flag in a valid state.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
cb5620c9b213f4bd323912159fdddda35e258a14 30-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support

This is required to use them in TableGen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c7629d941557f7179eb8fa8a2e2a74d749cbaf7c 24-Jan-2013 Jordan Rose <jordan_rose@apple.com> Handle universal character names and Unicode characters outside of literals.

This is a missing piece for C99 conformance.

This patch handles UCNs by adding a '\\' case to LexTokenInternal and
LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN.
If the UCN is not syntactically well-formed, we fall back to the old
treatment: a backslash followed by an identifier beginning with 'u' (or 'U').

Because the spelling of an identifier with UCNs still has the UCN in it, we
need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo.

Of course, valid code that does *not* use UCNs will see only a very minimal
performance hit (checks after each identifier for non-ASCII characters,
checks when converting raw_identifiers to identifiers that they do not
contain UCNs, and checks when getting the spelling of an identifier that it
does not contain a UCN).

This patch also adds basic support for actual UTF-8 in the source. This is
treated almost exactly the same as UCNs except that we consider stray
Unicode characters to be mistakes and offer a fixit to remove them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0a3cbd02ef4971d169cc1677ba7bb7be1c605cae 17-Jan-2013 David Blaikie <dblaikie@gmail.com> Remove unnecessary initialization i Added in r172668.

echristo already fixed this in r172649, but I'll leave the reformatting in
since I'm in the blame history for it now anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
4944606962e32babc4d67804f29874ba4f6a2b41 17-Jan-2013 David Blaikie <dblaikie@gmail.com> Fix -Wreorder warning.

Rewrapping courtesy of clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
214ea9de659f4bfb3cf45ec361cf8be35bc0218d 16-Jan-2013 Eric Christopher <echristo@gmail.com> Move initialization of ParsingIfOrElifDirective down next to the macro
initializations to fix Wreorder warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
31672b1745195d709b641f1c0f44e203742fa73b 16-Jan-2013 Aaron Ballman <aaron@aaronballman.com> No longer crashing with an assert when __has_include or __has_include_next is used outside of a preprocessor directive. This fixes PR14837.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
1fbf6fb5c7ecbf803e692f0d1622870a36cf83b7 12-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't warn about disabled macro expansion if we see the name of a function-like macro which isn't immediately followed by '('. FreeBSD's stdio.h #defines foo(x) to (foo)(x), apparently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169960 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
1b257afbae854c6817f26b7d61c4fed8ff7aebad 11-Dec-2012 Douglas Gregor <dgregor@apple.com> Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
37ed12720a35b7bfa1c4de73ad6f1c6c1c88ee17 04-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactor recording the preprocessor conditional directive regions out of
PreprocessingRecord and into its own class, PPConditionalDirectiveRecord.

Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord
without needing a PreprocessingRecord.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
97f8461a2c553f68a258612d2322e4281c3f0915 17-Nov-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Made the "expected string literal" diagnostic more expressive

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
02a176871d91bba3004e4f94b2d4d588ae4b2122 17-Nov-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Refactored duplicate string literal lexing code within Preprocessor, into a
common LexStringLiteral function. In doing so, some consistency problems have
been ironed out (e.g. where the first token in the string literal was lexed
with macro expansion, but subsequent ones were not) and also an erroneous
diagnostic has been corrected.

LexStringLiteral is complemented by a FinishLexStringLiteral function which
can be used in the situation where the first token of the string literal has
already been lexed.

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

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


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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f8afcffe6a0213760b64c211812b1750e1e1e967 29-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164874 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
374b3837d676133fcc1eb70a25c8baf8ec4a5c4a 24-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> StringRef'ize Preprocessor::CreateString().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164555 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
cd6df6695c87ea55bc5e3e59043744e7946d5fab 13-Aug-2012 Alexander Kornienko <alexfh@google.com> Added some preprocessor memory usage stats to -cc1 -print-stats

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
193f91ba7ed28709a1e730aedb3582353f9075d0 29-Jun-2012 Douglas Gregor <dgregor@apple.com> Patch for handling C99 veriadic macros when using precompiled headers,
from Filipe Cabecinhas!


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

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
9416d42468eacaae0ea85ab8ed134f5df1a1d142 19-Jun-2012 Meador Inge <meadori@codesourcery.com> Revert predefined decl tracking.

r158085 added some logic to track predefined declarations. The main reason we
had predefined declarations in the input was because the __builtin_va_list
declarations were injected into the preprocessor input. As of r158592 we
explicitly build the __builtin_va_list declarations. Therefore the predefined
decl tracking is no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6fe6a49c4058211ff4489023c78615ec0266c5ff 08-Jun-2012 Jordan Rose <jordan_rose@apple.com> Disable _Pragma during HTML macro rewriting to keep from crashing.

The preprocessor's handling of diagnostic push/pops is stateful, so
encountering pragmas during a re-parse causes problems. HTMLRewrite
already filters out normal # directives including #pragma, so it's
clear it's not expected to be interpreting pragmas in this mode.

This fix adds a flag to Preprocessor to explicitly disable pragmas.
The "right" fix might be to separate pragma lexing from pragma
parsing so that we can throw away pragmas like we do preprocessor
directives, but right now it's important to get the fix in.

Note that this has nothing to do with the "hack" of re-using the
input preprocessor in HTMLRewrite. Even if we someday copy the
preprocessor instead of re-using it, the copy would (and should) include
the diagnostic level tables and have the same problems.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
8c0b3787e7ccc7978b42dfbb84da2b802c743a5d 06-Jun-2012 David Blaikie <dblaikie@gmail.com> Add a -rewrite-includes option, which is similar to -rewrite-macros, but only expands #include directives.

Patch contributed by Lubos Lunak (l.lunax@suse.cz).
Review by Matt Beaumont-Gay (matthewbg@google.com).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
d73ef135ba029db59c0b5649e6117845d9e39600 06-Jun-2012 Jordan Rose <jordan_rose@apple.com> Add pedantic warning -Wempty-translation-unit (C11 6.9p1).

In standard C since C89, a 'translation-unit' is syntactically defined to have
at least one "external-declaration", which is either a decl or a function
definition. In Clang the latter gives us a declaration as well.

The tricky bit about this warning is that our predefines can contain external
declarations (__builtin_va_list and the 128-bit integer types). Therefore our
AST parser now makes sure we have at least one declaration that doesn't come
from the predefines buffer.

Also, remove bogus warning about empty source files. This doesn't catch source
files that only contain comments, and never fired anyway because of our
predefines.

PR12665 and <rdar://problem/9165548>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
25c2596b987ae6e22626252d231211ab06e1dc3f 02-Jun-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Initialize the non-target-dependent fields of the Preprocessor in its constructor
so we can destroy it even if it was constructed with "DelayInitialization = true",
and we didn't end up calling Preprocessor::Initialize.

Fixes crashes in rdar://11558355

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
14e645557ae91c6770d62beb00a1c522e0bfd5d6 03-Apr-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Correct handling of _Pragma macro inside a macro argument.

If we are pre-expanding a macro argument don't actually "activate"
the pragma at that point, activate the pragma whenever we encounter
it again in the token stream.
This ensures that we will activate it in the correct location
or that we will ignore it if it never enters the token stream, e.g:

\#define EMPTY(x)
\#define INACTIVE(x) EMPTY(x)
INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\""))

This also fixes the crash in rdar://11168596.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e55329d6834647ba0e06f8a319e5d84c77310035 16-Mar-2012 Axel Naumann <Axel.Naumann@cern.ch> From Vassil Vassilev:
Enable incremental parsing by the Preprocessor,
where more code can be provided after an EOF.
It mainly prevents the tearing down of the topmost lexer.
To be used like this:
PP.enableIncrementalProcessing();
while (getMoreSource()) {
while (Parser.ParseTopLevelDecl(ADecl)) {...}
}
PP.enableIncrementalProcessing(false);


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
c6c54521f95760a5eaf29b668d4bf41fe2af49d7 05-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Enhance PreprocessingRecord to keep track of locations of conditional directives.

Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns
true if a given range intersects with a conditional directive block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
32ad2ee2618745ce3da51c2ae066ed5f21157c07 01-Mar-2012 Ted Kremenek <kremenek@apple.com> Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
d7a3e2c5f61cd4893f95b69a424fe4def3aa0f69 07-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
8fe83e1df954d72c0f4ffc15d20a5222ec151c21 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move a method from IdentifierTable.h out of line and remove the SmallString include.

Fix all the transitive include users.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
fdd15602a42bbe26185978ef1e17019f6d969aa7 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Remove Diagnostic.h include from Preprocessor.h.

- Move the offending methods out of line and fix transitive includers.
- This required changing an enum in the PPCallback API into an unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
e434ec71fccfe078906403affd641f709702d598 29-Jan-2012 Douglas Gregor <dgregor@apple.com> Rework HeaderSearch's interface for getting a module from a name and
for getting the name of the module file, unifying the code for
searching for a module with a given name (into lookupModule()) and
separating out the mapping to a module file (into
getModuleFileName()). No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b8c879a5363f36bdae8831112b563333e3c05acb 05-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When loading an AST file, set SourceManager::MainFileID to the main file of the AST file,
as suggested by Tom Honermann.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
d6aba06861c41ccbc4926e5fe3cecd97b20410c0 04-Jan-2012 Douglas Gregor <dgregor@apple.com> Don't treat 'import' as a contextual keyword when we're in a caching lexer, or when modules are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c13a34b690d2dc2a03c2fea75a0a1438636c19ce 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Eliminate the uglified keyword __import_module__ for importing
modules. This leaves us without an explicit syntax for importing
modules in C/C++, because such a syntax needs to be discussed
first. In Objective-C/Objective-C++, the @import syntax is used to
import modules.

Note that, under -fmodules, C/C++ programs can import modules via the
#include mechanism when a module map is in place for that header. This
allows us to work with modules in C/C++ without committing to a syntax.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
5948ae1021122164b22f74353bb7fe325a64f616 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce a non-uglified syntax for module imports in Objective-C:

@import identifier [. identifier]* ;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
752c74d99b647710a495c2ff5f815c30a30c3264 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Add a "Modules" language option, which subsumes the previous
"AutoModuleImport" preprocessor option and is tied to -fmodules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
163ada8a0f56a9928feaaaf11a4eb7d41f65a0e2 01-Jan-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added -Wdisabled-macro-expansion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
93ebfa6139bbca4d446c7343e3afc8e5ec777484 03-Dec-2011 Douglas Gregor <dgregor@apple.com> When we treat an #include or #import as a module import, create an
implicit ImportDecl in the translation unit to record the presence of
the import.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
90db26000aefe9335370013eec64c85232d80227 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Implementing parsing and resolution of module export declarations
within module maps, which will (eventually) be used to re-export a
module from another module. There are still some pieces missing,
however.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
5e35693721364673f8196e4f5a370f56b92e6053 01-Dec-2011 Douglas Gregor <dgregor@apple.com> Introduce the notion of name visibility into modules. For a given
(sub)module, all of the names may be hidden, just the macro names may
be exposed (for example, after the preprocessor has seen the import of
the module but the parser has not), or all of the names may be
exposed. Importing a module makes its names, and the names in any of
its non-explicit submodules, visible to name lookup (transitively).

This commit only introduces the notion of name visible and marks
modules and submodules as visible when they are imported. The actual
name-hiding logic in the AST reader will follow (along with test cases).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b514c792821a8f053027d88444e13bfaa8efef76 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Teach the preprocessor how to handle module import declarations that
involve submodules (e.g., importing std.vector), rather than always
importing the top-level module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3d3589db579f7695667b913c5043dd264ebe546f 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Switch the module-loading interfaces and parser from a simple
top-level module name to a module path (e.g., std.vector). We're still
missing a number of pieces for this actually to do something.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e93433db8bc4e6a8e8f0b1b55728085ce0f276a9 23-Nov-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove an assertion that is not valid if we cancel parsing.

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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
98d86b98b3fd0bd9c546123b16fd9995509aaae1 11-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add a -Wc++0x-compat warning for C++11 keywords used as identifiers when in
C++98 mode. Only the first occurrence of each keyword will produce a warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
a08529cc3f00e0b47a3c028823634129ac46847b 03-Oct-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed exapnsion range for # and ##.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141012 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
7e7b503211f1c0ae1537da4657c9ed34f69b3506 26-Sep-2011 Zhongxing Xu <xuzhongxing@foxmail.com> Properly initialize Preprocessor::CurLexerKind to avoid use of uninitialized variable.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
fba18aa8f2cd1994dc65e8cb9f4be201c560dc0b 16-Sep-2011 Douglas Gregor <dgregor@apple.com> Add an experimental flag -fauto-module-import that automatically turns
#include or #import direcctives of framework headers into module
imports of the corresponding framework module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b8db7cd9ac05c522855631670ec2e97255384f5a 08-Sep-2011 Douglas Gregor <dgregor@apple.com> Optimize the preprocessor's handling of the __import_module__
keyword. We now handle this keyword in HandleIdentifier, making a note
for ourselves when we've seen the __import_module__ keyword so that
the next lexed token can trigger a module import (if needed). This
greatly simplifies Preprocessor::Lex(), and completely erases the 5.5%
-Eonly slowdown Argiris noted when I originally implemented
__import_module__. Big thanks to Argiris for noting that horrible
regression!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
41a50a9b730cf52bd4c34d3895f00ae32f458eb5 04-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> Use const_cast to avoid warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
7d100872341f233c81e1d7b72b40457e62c36862 04-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support code-completion for C++ inline methods and ObjC buffering methods.

Previously we would cut off the source file buffer at the code-completion
point; this impeded code-completion inside C++ inline methods and,
recently, with buffering ObjC methods.

Have the code-completion inserted into the source buffer so that it can
be buffered along with a method body. When we actually hit the code-completion
point the cut-off lexing or parsing.

Fixes rdar://10056932&8319466

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.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/Lex/Preprocessor.cpp
c0846d623b2ef8502ff3ebcbf2cf37a6b0ab9f93 31-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Make sure to initialize field. Hopefully this will fix some test failures on Windows.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138880 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
65030af6526748ce11534e92f0ccefc44091ba13 31-Aug-2011 Douglas Gregor <dgregor@apple.com> Switch __import__ over to __import_module__, so we don't conflict with
existing practice with Python extension modules. Not that Python
extension modules should be using a double-underscored identifier
anyway, but...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6be16fe900bdd1e5f677d23ae34fffead5bcfc77 27-Aug-2011 Douglas Gregor <dgregor@apple.com> Take an entirely different approach to handling the "parsing" of
__import__ within the preprocessor, since the prior one foolishly
assumed that Preprocessor::Lex() was re-entrant. We now handle
__import__ at the top level (only), after macro expansion. This should
fix the buildbot failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
67485096e1211567a01128276bc132aefacba053 27-Jul-2011 Ted Kremenek <kremenek@apple.com> Change Preprocessor::getTotalMemory() to use llvm::capacity_in_bytes().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
91d1bd6ede1d101a2e49719250c33154b39e0016 26-Jul-2011 Ted Kremenek <kremenek@apple.com> Report more memory using in Preprocessor::getTotalMemory() and PreprocessingRecord::getTotalMemory().

Most of the memory was already reported; but now we report more memory from side data structures.

Fixes <rdar://problem/9379717>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
bf340e452339e374ea6eef78c1f0a2abdd16c5a3 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename create(MacroArg)InstantiationLoc to create(MacroArg)ExpansionLoc.

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

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
5b3284a9275a27f5c4410e25eb8933be540601d6 30-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a caching mechanism for macro expanded tokens.

Previously macro expanded tokens were added to Preprocessor's bump allocator and never released,
even after the TokenLexer that were lexing them was finished, thus they were wasting memory.
A very "useful" boost library was causing clang to eat 1 GB just for the expanded macro tokens.

Introduce a special cache that works like a stack; a TokenLexer can add the macro expanded tokens
in the cache, and when it finishes, the tokens are removed from the end of the cache.

Now consumed memory by expanded tokens for that library is ~ 1.5 MB.

Part of rdar://9327049.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c5c5e92ec53f7e6ac7ebbbf77c6d8e4b7d88daec 30-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
28bbe4b8acc338476fe0825769b41fb32b423c72 28-Apr-2011 John Wiegley <johnw@boostpro.com> Parsing/AST support for Structured Exception Handling

Patch authored by Sohail Somani.

Provide parsing and AST support for Windows structured exception handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
834e3f6c77d9ac03997a3f0c56934edcf406a355 08-Mar-2011 John McCall <rjmccall@apple.com> Fix my earlier commit to work with escaped newlines and leave breadcrumbs
in case we want to make a world where we can check intermediate instantiations
for this kind of breadcrumb.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127221 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
30900dafbe972f4802c2663262b4393edab0d1cd 08-Mar-2011 John McCall <rjmccall@apple.com> Add an API call to retrieve the spelling data of a token from its SourceLocation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127216 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c4bf2b9afb7d47445a9dc6bc848657098a4e3851 22-Dec-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Introduced raw_identifier token kind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
b0607279cb98bbf2bbfe0db170aed39ef91e86a2 17-Nov-2010 Chris Lattner <sabre@nondot.org> move getSpelling from Preprocessor to Lexer, which it is more conceptually related to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
7ef5c27eb6e8ebe58b52013246c06753c3613263 17-Nov-2010 Chris Lattner <sabre@nondot.org> move AdvanceToTokenCharacter and getLocForEndOfToken from
Preprocessor to Lexer where they make more sense.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
872a45e91778eb0b706ff57272fe547d4512eb19 17-Nov-2010 Chris Lattner <sabre@nondot.org> add a static version of PP::AdvanceToTokenCharacter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
48cf9824fbad42995f4d91d59d08d2620effd683 17-Nov-2010 Chris Lattner <sabre@nondot.org> add a static form of the efficient PP::getSpelling method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
9714a2385cb66b6efa373fc668641de602dd9adb 20-Oct-2010 Ted Kremenek <kremenek@apple.com> Really^2 fix <rdar://problem/8361834>, this time without crashing.

Now MICache is a linked list (per the FIXME), where we tradeoff between MacroInfo objects being in MICache
and MIChainHead. MacroInfo objects in the MICache chain are already "Destroy()'ed", so they can be reused. When
inserting into MICache, we need to remove them from the regular linked list so that they aren't destroyed more than
once.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2a6b03af69cb25b15fc9488ff593e427d3214217 19-Oct-2010 Ted Kremenek <kremenek@apple.com> Simplify loop. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
af8fa25c0d4e0540952a50bbd06dc1558954ccd9 19-Oct-2010 Ted Kremenek <kremenek@apple.com> Simplify lifetime management of MacroInfo objects in Preprocessor by having the Preprocessor maintain them in a linked
list of allocated MacroInfos. This requires only 1 extra pointer per MacroInfo object, and allows us to blow them
away in one place. This fixes an elusive memory leak with MacroInfos (whose exact location I couldn't still figure
out despite substantial digging).

Fixes <rdar://problem/8361834>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e6a7dabdefd328729bdcf15a434108b4c0bc64fb 19-Oct-2010 Ted Kremenek <kremenek@apple.com> In ~Preprocessor(), also cleanup the MacroInfo objects left-over from stray "#pragma push_macro" uses. This
fixes a potential memory leak.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
afbc68177cc11b8bfa47464b20e15d5f8fb21d4e 03-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Use getSpelling to get original text of the
c++ operator token. (radar 8328250).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
be74740cc246ce08d42804a684385a42eb814edb 03-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Patch to allow alternative representation of c++
operators (and, or, etc.) to be used as selectors
to match g++'s behavior.



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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0016d519b831859526b79405cdae4c64c73731c8 29-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement C++0x user-defined string literals.

The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
043266b2bba2ad36f59130168d4a64287213e277 26-Aug-2010 Douglas Gregor <dgregor@apple.com> Tweak wording in an assertion, from dawn@burble.org.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112182 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
55817afdf9d453a443262a733f6caf6692dca118 25-Aug-2010 Douglas Gregor <dgregor@apple.com> Introduce a preprocessor code-completion hook for contexts where we
expect "natural" language and should not provide any completions,
e.g., comments, string literals, #error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9 24-Aug-2010 Douglas Gregor <dgregor@apple.com> Introduce basic code-completion support for preprocessor directives,
e.g., after a "#" we'll suggest #if, #ifdef, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2c1ab9079cb117dc0470ab423fe0bc5177546339 18-Aug-2010 Chris Lattner <sabre@nondot.org> no need to pass bumppointer allocator into macroinfo::destroy


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
476d8b863cb65b2b5833235d97315cdb46e6f5aa 11-Aug-2010 Benjamin Kramer <benny.kra@googlemail.com> Random temporary string cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
9b36c3f0de0105e903130bbda3c4aea7d792c0af 13-Jul-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.

When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.

As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
83c1a6fb4126f080387de2a97cddefe458188106 09-Jun-2010 Ted Kremenek <kremenek@apple.com> Fix memory leak in Preprocessor where MacroInfo objects in the MICache wouldn't have their
associated SmallVectors get deallocated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e127a0d80155b45dafe77f2b4380e5fa111a3345 20-Apr-2010 Chris Lattner <sabre@nondot.org> push some source location information down through the compiler,
into ContentCache::getBuffer. This allows it to produce
diagnostics on the broken #include line instead of without a
location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
a0a270c0f1c0a4e3482438bdc5f4a7bd3d25f0a6 06-Apr-2010 Chris Lattner <sabre@nondot.org> Match MemoryBuffer API changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
dbd8209b33e6c9f151e4913a9c095d64a95439c4 23-Mar-2010 Daniel Dunbar <daniel@zuster.org> PPCallbacks: Add hook for reaching the end of the main file, and fix DependencyFile to not do work in its destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b9e1b75772db2c7db566c6034ba90a07f22e35eb 19-Mar-2010 Douglas Gregor <dgregor@apple.com> Make the preprocessing record a PPCallbacks subclass itself,
eliminating the extra PopulatePreprocessingRecord object. This will
become useful once we start writing the preprocessing record to
precompiled headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
dbf8ee630e4c86e5150492eaf8dbceea3c718ee1 17-Mar-2010 Douglas Gregor <dgregor@apple.com> Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
a543016fe07030f695d6d56fd22c8c8da617e0d7 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Audit all callers of SourceManager::getCharacterData(); update some of
them to recover more gracefully on failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
aa38c3d326de8f9292e188f0aeb8039254c8d683 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Teach the one caller of SourceManager::getMemoryBufferForFile() to cope with errors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
50f6af7a6d6951a63f3da7d4c5a7d3965bf73b63 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce optional "Invalid" parameters to routines that invoke the
SourceManager's getBuffer() and, therefore, could fail, along with
Preprocessor::getSpelling(). Use the Invalid parameters in the literal
parsers (string, floating point, integral, character) to make them
robust against errors that stem from, e.g., PCH files that are not
consistent with the underlying file system.

I still need to audit every use caller to all of these routines, to
determine which ones need specific handling of error conditions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
193575455e00eca03fd7177f60e3f2e6263cb661 13-Mar-2010 Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> Use SmallString instead of SmallVector

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
51f5fe3f2527cd1640d798d8d134268b14de3e86 27-Feb-2010 Benjamin Kramer <benny.kra@googlemail.com> Move method out-of-line. I thought this would be a candidate for inlining but I was wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
ddeea5644367c9c153c9fee9e51bdea85ce43cbd 27-Feb-2010 Benjamin Kramer <benny.kra@googlemail.com> Add an overload of Preprocessor::getSpelling which takes a SmallVector and
returns a StringRef. Use it to simplify some repetitive code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c0178e9cf47dd8300616b955dd820342cf339e4c 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Fix subtle bug in Preprocessor::AdvanceToTokenCharacter(): use '+=' instead of '='.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
33e9abd21083a0191a7676a04b497006d2da184d 22-Jan-2010 Douglas Gregor <dgregor@apple.com> Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.

Minor other tweaks needed to make this work:
- Extend Preprocessor::getLocForEndOfToken() to accept an offset
from the end, making it easy to move to the last character in the
token (rather than just past the end of the token).
- In Lexer::MeasureTokenLength(), the length of whitespace is zero.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
046c2277dcbcc8eb89dbb5b1b8c5226b7cb81635 18-Jan-2010 Chris Lattner <sabre@nondot.org> allow the HandlerComment callback to push tokens into the
preprocessor. This could be used by an OpenMP implementation
or something. Patch by Abramo Bagnara!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93795 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
88a35862fbe473f2a4f0c19f24dbe536937e1dc6 04-Jan-2010 Douglas Gregor <dgregor@apple.com> Teach Preprocessor::macro_begin/macro_end to lazily load all macro
definitions from a precompiled header. This ensures that
code-completion with macro names behaves the same with or without
precompiled headers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
ffd6e39006a7177c4c537a6ce701bcd852fb3e7c 31-Dec-2009 Benjamin Kramer <benny.kra@googlemail.com> Avoid an unnecessary copy of Predefines. getMemBufferCopy does the null termination for us.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
23f77e59718385512984d4e2a021bef52b9f6ddf 15-Dec-2009 Chris Lattner <sabre@nondot.org> set up the machinery for a MacroArgs cache hanging off Preprocessor.
We creating and free thousands of MacroArgs objects (and the related
std::vectors hanging off them) for the testcase in PR5610 even though
there are only ~20 live at a time. This doesn't actually use the
cache yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2b9d6377f1b749ab8ada8fc2cff05954cd4731ae 14-Dec-2009 Chris Lattner <sabre@nondot.org> fix typo


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91343 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b760fe8fafde1d9d9f1f01db57a88cd9ce636342 08-Dec-2009 Douglas Gregor <dgregor@apple.com> Don't expand tabs when computing the offset from the code-completion column

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
63ceaa32a2371e38d1f912080fe471285e6b6e56 06-Dec-2009 Daniel Dunbar <daniel@zuster.org> Change Preprocessor::EnterSourceFile to make ErrorStr non-optional, clients should be forced to deal with error conditions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
109ae73ec71a1d27358510ce049b59637b4a6b40 03-Dec-2009 Douglas Gregor <dgregor@apple.com> Minor cleanup to the code-completion-point logic suggested by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2968442603b029949246467253eeac8139a5b6d8 02-Dec-2009 Douglas Gregor <dgregor@apple.com> Extend the source manager with the ability to override the contents of
files with the contents of an arbitrary memory buffer. Use this new
functionality to drastically clean up the way in which we handle file
truncation for code-completion: all of the truncation/completion logic
is now encapsulated in the preprocessor where it belongs
(<rdar://problem/7434737>).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0ff1042ddaad1419264be0de6da17f3b378482a4 14-Nov-2009 Daniel Dunbar <daniel@zuster.org> Add static version of Preprocessor::getSpelling.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
5814e657c9ad9ef6049a2a4af0d2aad248a8a15c 11-Nov-2009 Daniel Dunbar <daniel@zuster.org> Allow Preprocessor to take ownership of the HeaderSearch object. I think it should probably always own the header search object, but I'm not sure...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c3222091e1ffa35d0264ca6b680a88c9dc84ede2 05-Nov-2009 Daniel Dunbar <daniel@zuster.org> Make LookUpIdentifierInfo const. This makes the Identifiers table mutable and is
a little fuzzy, but conceptually it's just uniquing the identifier.

Chris, please review. I debated splitting into const/non-const versions where
the const one propogated constness to the resulting IdentifierInfo*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3da736c1143126be19b253804b3b135ebcd3d6ff 05-Nov-2009 Daniel Dunbar <daniel@zuster.org> StringRefize Preprocessor::getIdentifierInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
90b1827c1c1cf075266b96b416eefcf37924333b 05-Nov-2009 Daniel Dunbar <daniel@zuster.org> Kill PreprocessorFactory, which was both morally repugnant and totally unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e013d685c6689ac7ae103ee88acf573422d1ed6a 18-Oct-2009 Daniel Dunbar <daniel@zuster.org> Move clients to use IdentifierInfo::getNameStart() instead of getName()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
52e7108f51a4a9f4d6e84f33fb594d06e1d79560 16-Oct-2009 Douglas Gregor <dgregor@apple.com> Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this
change is that we can now generate a PCH/AST file when including
another PCH file; in the future, the chain of stat caches will likely
be useful with multiple levels of PCH files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b657f115c3b4e262e72906a28cbcf3eaccd9460c 22-Sep-2009 Douglas Gregor <dgregor@apple.com> Replace the -code-completion-dump option with

-code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82571 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
81b747b7fcc91c2fba9a3183d8fac80adbfc1d3e 17-Sep-2009 Douglas Gregor <dgregor@apple.com> Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.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/Lex/Preprocessor.cpp
6cb7c1a43b0c8f739d1f54b7fdae5ede86033496 23-Aug-2009 Benjamin Kramer <benny.kra@googlemail.com> Replace cerr with errs().


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

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

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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
030e8fe5aabe6a50ed7da3182df8cbce446bfeab 16-Jun-2009 Chris Lattner <sabre@nondot.org> my refactoring of builtins changed target-specific builtins to only be
registered when PCH wasn't being used. We should always install (in BuiltinInfo)
information about target-specific builtins, but we shouldn't register any builtin
identifier infos. This fixes the build of apps that use PCH and target specific
builtins together.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2962f4d71d26817780e7441b23e0e91214fceb5e 28-Apr-2009 Eli Friedman <eli.friedman@gmail.com> Emit keyword extension warning in all modes, not just C99 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
88e2524b8f3393975872a23bbe6e8b3cf50d6773 19-Apr-2009 Chris Lattner <sabre@nondot.org> Change Preprocessor::AdvanceToTokenCharacter to stop at
the first real character of a token. For example, advancing
to byte 3 of foo\
bar

should stop at the b, not the \.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
390c8cea4a35d94fe3ff88fa22722aeecdf2b648 18-Apr-2009 Chris Lattner <sabre@nondot.org> fix typo


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2c78b873f4f3823ae859c15674cb3d76c8554113 15-Apr-2009 Chris Lattner <sabre@nondot.org> Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:

t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~~^

instead of the woefully inferior:

t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^

Most of this is just plumbing to push the reference around.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c1f9d828c733ec1eba06d01070735d1f36fda733 13-Apr-2009 Chris Lattner <sabre@nondot.org> implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e1d918e9fe55e3b34401fd5d420c47ea0f9572c9 11-Apr-2009 Douglas Gregor <dgregor@apple.com> Compare the predefines buffer in the PCH file with the predefines
buffer generated for the current translation unit. If they are
different, complain and then ignore the PCH file. This effectively
checks for all compilation options that somehow would affect
preprocessor state (-D, -U, -include, the dreaded -imacros, etc.).

When we do accept the PCH file, throw away the contents of the
predefines buffer rather than parsing them, since all of the results
of that parsing are already stored in the PCH file. This eliminates
the ugliness with the redefinition of __builtin_va_list, among other
things.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
531cc8355608295caa01f31fa4e078d77a3d6470 11-Apr-2009 Chris Lattner <sabre@nondot.org> do a dance with predefines, and finally enable reading of macros from
PCH. This works now, except for limitations not being able to do things
with identifiers. The basic example in the testcase works though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68832 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6bf0f4ce59a7a7e177dd2154f9b6f790d70fbf4a 10-Apr-2009 Chris Lattner <sabre@nondot.org> move a bunch of code for initializing the predefines buffer out of Preprocessor.cpp
into clang-cc.cpp. This makes it so clang-cc constructs the *entire* predefines
buffer, not just half of it. A bonus of this is that we get to kill a copy
of DefineBuiltinMacro.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
14f79002e58556798e86168c63e48d533287eda5 10-Apr-2009 Douglas Gregor <dgregor@apple.com> PCH serialization/deserialization of the source manager. With this
improvement, source locations read from the PCH file will properly
resolve to the source files that were used to build the PCH file
itself.

Once we have the preprocessor state stored in the PCH file, source
locations that refer to macro instantiations that occur in the PCH
file should have the appropriate instantiation information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3bbc75302fd43cf13d868b46c94ff8794b302e43 08-Apr-2009 Daniel Dunbar <daniel@zuster.org> More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
defined (instead of __DYNAMIC__).

- Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.

- Set __NO_INLINE__ following GCC 4.2.

- Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.

- Set __EXCEPTIONS for Objective-C NonFragile ABI.

- Set __STRICT_ANSI__ for standard conforming modes.

- I added a clang style test case in utils for this, but its not
particularly portable and I don't think it belongs in the test
suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68621 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
9fd0b1f845a61e71dd8099f596532d34c519630a 08-Apr-2009 Daniel Dunbar <daniel@zuster.org> Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
updated driver to pass this.

- Added __pic__

- Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3a5cbd37c91d29bbd169ae869b234ed1fc954cb6 07-Apr-2009 Chris Lattner <sabre@nondot.org> The __weak and __strong defines are common to all darwin targets
and are even set in C mode. As such, move them to Targets.cpp.

__OBJC_GC__ is also darwin specific, but seems reasonable to always
define it when in objc-gc mode.

This fixes rdar://6761450


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
4ca076fffdfa72ebfab364c8de091b89fc291ae6 06-Apr-2009 Anders Carlsson <andersca@mac.com> Define __OPTIMIZE__ and __OPTIMIZE_SIZE__ if the -O[12] and -Os flags are passed to the compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
47e60ac311d03a5813da70dd894b503d1c5c7c95 27-Mar-2009 Fariborz Jahanian <fjahanian@apple.com> Put back __OBJC2__ definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
dbf15cb5709067b3d23b3cdd8d014610ba4a8783 26-Mar-2009 Fariborz Jahanian <fjahanian@apple.com> - Minor change to dump of ivar layout map.
- Temporarily undef'ed __OBJC2__ in nonfragile objc abi mode
as it was forcing ivar synthesis in a certain project which clang
does not yet support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3fec8ffb5fc1d461bec8e5f38fc1df69dfcec430 24-Mar-2009 Chris Lattner <sabre@nondot.org> change the __VERSION__ string to be more sensible. It would be useful to include the clang version # too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f2e880a99c8b08976069331283392cc22b07701d 20-Mar-2009 Chris Lattner <sabre@nondot.org> rename the <predefines> buffer to <built-in> to solve PR3849.
Add a #include directive around the command line buffer so that
diagnostics generated from -include directives get diagnostics
like:

In file included from <built-in>:98:
In file included from <command line>:3:
./t.h:2:1: warning: type specifier missing, defaults to 'int'
b;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
33328642a7a8a126918814ddcbcebf83c121ad54 20-Mar-2009 Chris Lattner <sabre@nondot.org> pass LangOptions into TargetInfo::getTargetDefines, so that targets
can have language-specific defines.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
76b1c842c3932d3f83b3abf999dd9622e3e5fb12 15-Mar-2009 Anders Carlsson <andersca@mac.com> (Hopefully) instantiate dependent array types correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
836040f9eafe862fb1607df5c30cd3df0c22c832 13-Mar-2009 Chris Lattner <sabre@nondot.org> make Preprocessor::Diags be a pointer instead of a reference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
8d4a9d37fd636684d2334c55a5eb1f4163a6746f 09-Mar-2009 Chris Lattner <sabre@nondot.org> fix PR3768, Clang does -D__STDC_HOSTED__=1, even if -ffreestanding is passed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2ace928d2799dfe4f2e0f6e5a15196e30dedc04a 07-Mar-2009 Mike Stump <mrs@apple.com> Fix warnings in build on clang-x86_64-freebsd buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3daed52a57d03765223021f5f921bdc280c8f3cc 02-Mar-2009 Chris Lattner <sabre@nondot.org> improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b2fb6de9070fea9abc56c8e8d5469066e964cefe 27-Feb-2009 Douglas Gregor <dgregor@apple.com> Clean up and document code modification hints.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
685befeb5f6472585bae473a6389e47cab9eac67 20-Feb-2009 Chris Lattner <sabre@nondot.org> switch the macroinfo argument lists from being allocated off the heap
to being allocated from the same bumpptr that the MacroInfo objects
themselves are.

This speeds up -Eonly cocoa.h pth by ~4%, fsyntax-only is barely measurable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65195 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
cf29e0716bb3ecbbc15b74cd648367d6b075fdf0 20-Feb-2009 Chris Lattner <sabre@nondot.org> detemplatify setArgumentList and some other cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0301b3ff132a4d986c092d161cb77d74b04cd2a6 20-Feb-2009 Chris Lattner <sabre@nondot.org> require the MAcroInfo objects are explcitly destroyed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65179 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6dcf63e920e003ea73cff332492dc11690b100a6 18-Feb-2009 Chris Lattner <sabre@nondot.org> update comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2197c963543397777919cec22b65feb31a9ddf79 18-Feb-2009 Chris Lattner <sabre@nondot.org> Fix some issues handling sub-token locations that come from macro expansions.
We now emit:

t.m:6:15: warning: field width should have type 'int', but argument has type 'unsigned int'
printf(STR, (unsigned) 1, 1);
^ ~~~~~~~~~~~~
t.m:3:18: note: instantiated from:
#define STR "abc%*ddef"
^

which has the correct location in the string literal in the note line.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2639e4f88482a5ab41f65918d71453acb9d3d45d 16-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> define __OBJC2__ for objc's nonfragile abi.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
cfdff38e8e931c0020dff10a32221d8fedb287a6 16-Feb-2009 Chris Lattner <sabre@nondot.org> Add support for deprecated members of RecordDecls (e.g. struct fields).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e7fb48466afcbf2c4ccdfa658824282fdc3c512c 15-Feb-2009 Chris Lattner <sabre@nondot.org> track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full
range of the macro that got replaced. For object-like macros, this doesn't
change anything. For _Pragma and function-like macros, this means we track
the locations of the ')'.

This is required for PR3579 because apparently GCC uses the line of the ')'
of a function-like macro as the location to expand __LINE__ to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6ad474f82f0cf32e13128d89fa5ad3a37ae73530 13-Feb-2009 Chris Lattner <sabre@nondot.org> Give TargetInfo a new IntPtrType to hold the intptr_t type for
a target.

Make Preprocessor.cpp define a new __INTPTR_TYPE__ macro based on this.

On linux/32, set intptr_t to int, instead of long. This fixes PR3563.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
05db4278ecd193edcff63fb8c54818226fceaad2 13-Feb-2009 Chris Lattner <sabre@nondot.org> Fix rdar://6562329, a static analyzer crash Ted noticed on
wine sources. This was happening because HighlightMacros was
calling EnterMainFile multiple times on the same preprocessor
object and getting an assert due to the new #line stuff (the
file in question was bison output with #line directives).

The fix for this is to not reenter the file. Instead,
relex the tokens in raw mode, swizzle them a bit and repreprocess
the token stream. An added bonus of this is that rewrite macros
will now hilight the macro definition as well as its uses. Woo.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
337edcdbec05316b407d0d64865c88ff8597d910 12-Feb-2009 Ted Kremenek <kremenek@apple.com> PTH: Cache stat information for files in the PTH file. Hook up FileManager
to use this stat information in the PTH file using a 'StatSysCallCache' object.

Performance impact (Cocoa.h, PTH):
- number of stat calls reduces from 1230 to 425
- fsyntax-only: time improves by 4.2%

We can reduce the number of stat calls to almost zero by caching negative stat
calls and directory stat calls in the PTH file as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
03c972767e6f1a9be8540f29edd110b27fbb6b59 06-Feb-2009 Chris Lattner <sabre@nondot.org> Export __INT8_TYPE__ / __INT16_TYPE__ / __INT32_TYPE__ / __INT64_TYPE__
in a gcc 4.5 compatible way so that stdint.h can follow the compiler's
notion of types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f668a714b1b72d126e218ecb67d744ff1fef2e17 06-Feb-2009 Chris Lattner <sabre@nondot.org> -funsigned-char sets __CHAR_UNSIGNED__


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f73903a1ded46748e1dfda151f5d037b7b3d31f9 06-Feb-2009 Chris Lattner <sabre@nondot.org> Add an implementation of -dM that follows GCC closely enough to permit
diffing the output of:
clang -dM -o - -E -x c foo.c | sort


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3c3b155ea8dfa29954a689a855d537a9ff2f12af 06-Feb-2009 Chris Lattner <sabre@nondot.org> get __WCHAR_TYPE__ from the targetinfo hook


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2b5abf515f9696912452f431c7738691cf97f4f1 06-Feb-2009 Chris Lattner <sabre@nondot.org> simplify and refactor a bunch of type definition code in Preprocessor
predefines buffer initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
86d85b8e5e55db3079c9c22aecdb30d830793a50 06-Feb-2009 Chris Lattner <sabre@nondot.org> remove some ad-hocery and use DefineTypeSize for more things.
Now you too can have a 47 bit long long!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63918 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
996feccdec6c865a2f9d11faac7e0970e7aebb1b 06-Feb-2009 Chris Lattner <sabre@nondot.org> refactor some code into a DefineTypeSize function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
659dc14559f7dc6e635810d5e0f6dca643549817 05-Feb-2009 Chris Lattner <sabre@nondot.org> correct and generalize computation of __INTMAX_MAX__.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
d427ad4cceab4481be0ac5cc2a190148ccc181e2 05-Feb-2009 Chris Lattner <sabre@nondot.org> fix some differences between apple gcc and clang on darwin/x86-32.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63846 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
500d3297d2a21edeac4d46cbcbe21bc2352c2a28 29-Jan-2009 Chris Lattner <sabre@nondot.org> move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes. Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
20c6b3b85e186cd52d5d99489132d71d498159eb 27-Jan-2009 Chris Lattner <sabre@nondot.org> Split the single monolithic DiagnosticKinds.def file into one
.def file for each library. This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.

Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b9c3f966b103f7cfe8e5e60007c4c8b38f7298eb 27-Jan-2009 Chris Lattner <sabre@nondot.org> Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line. This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not
dependency generation!).

This patch also includes several cleanups along the way:

- SourceLocation now has a dump method, and several other places
that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide
any #line functionality.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
277faca30c9f8f72b79f55695cbe3395ec246e7c 27-Jan-2009 Ted Kremenek <kremenek@apple.com> PTH: Use Token::setLiteralData() to directly store a pointer to cached spelling data in the PTH file. This removes a ton of code for looking up spellings using sourcelocations in the PTH file. This simplifies both PTH-generation and reading.

Performance impact for -fsyntax-only on Cocoa.h (with Cocoa.h in the PTH file):
- PTH generation time improves by 5%
- PTH reading improves by 0.3%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63072 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
47246be8ac5b0ddde6c402b8fc6946b6135487b5 26-Jan-2009 Chris Lattner <sabre@nondot.org> This change refactors some of the low-level lexer interfaces a bit.
Token now has a class of kinds for "literals", which include
numeric constants, strings, etc. These tokens can optionally have
a pointer to the start of the token in the lexer buffer. This
makes it faster to get spelling and do other gymnastics, because we
don't have to go through source locations.

This change is performance neutral, but will make other changes
more feasible down the road.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63028 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
863c486fcb6162495a94fddf7ac8409de2638995 23-Jan-2009 Chris Lattner <sabre@nondot.org> This is a follow-up to r62675:

Refactor how the preprocessor changes a token from being an tok::identifier to a
keyword (e.g. tok::kw_for). Instead of doing this in HandleIdentifier, hoist this
common case out into the caller, so that every keyword doesn't have to go through
HandleIdentifier. This drops time in HandleIdentifier from 1.25ms to .62ms, and
speeds up clang -Eonly with PTH by about 1%.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6a170eb3ea6d6319277becabef68eb1a26bf8766 21-Jan-2009 Chris Lattner <sabre@nondot.org> Add a bit to IdentifierInfo that acts as a simple predicate which
tells us whether Preprocessor::HandleIdentifier needs to be called.
Because this method is only rarely needed, this saves a call and a
bunch of random checks. This drops the time in HandleIdentifier
from 3.52ms to .98ms on cocoa.h on my machine.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
9ee7d456b427e002f7fe1844b64bec8055c8db52 19-Jan-2009 Ted Kremenek <kremenek@apple.com> Run destructors of MacroInfo objects to free memory they allocate. This addresses <rdar://problem/6506035>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
28c90ad7ef7c609a0b10c2f68b519ef69e7084d1 17-Jan-2009 Chris Lattner <sabre@nondot.org> in Preprocessor::AdvanceToTokenCharacter, don't actually bother
creating a whole lexer when we just want one static method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
6b7b84036126a8f2a3e312cfec0a9a4f8ae9d8ed 17-Jan-2009 Chris Lattner <sabre@nondot.org> suck the call to "getSpellingLoc" that all clients do into
the implementation of PTHManager::getSpelling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2b2453a7d8fe732561795431f39ceb2b2a832d84 17-Jan-2009 Chris Lattner <sabre@nondot.org> this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation. *That* FileID may refer to the start of a file or to a
chunk within it. The new FileID *only* refers to the file (and its
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f7cf85b330bedd2877e1371fb0a83e99751ae162 16-Jan-2009 Chris Lattner <sabre@nondot.org> more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
fff745ee450800fed6eb8e515c0866dcb7c4def4 16-Jan-2009 Chris Lattner <sabre@nondot.org> remove obsolete comment which happened to go over 80 cols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
9938d0731d627fd6dad28faa3acd07f1c6050af0 16-Jan-2009 Chris Lattner <sabre@nondot.org> remove an unneeded const_cast.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
df7c17a8d02fe09a3466786bae3e40fc3252687a 16-Jan-2009 Chris Lattner <sabre@nondot.org> Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location.
This is more concrete and useful, tokens aren't really physical objects!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
72b1b15ee88aac0a63e2c1dc53fe22f5ab297b20 15-Jan-2009 Ted Kremenek <kremenek@apple.com> IdentifierInfo:
- IdentifierInfo can now (optionally) have its string data not be
co-located with itself. This is for use with PTH. This aspect is a
little gross, as getName() and getLength() now make assumptions
about a possible alternate representation of IdentifierInfo.
Perhaps we should make IdentifierInfo have virtual methods?

IdentifierTable:
- Added class "IdentifierInfoLookup" that can be used by
IdentifierTable to perform "string -> IdentifierInfo" lookups using
an auxilliary data structure. This is used by PTH.
- Perform tests show that IdentifierTable::get() does not slow down
because of the extra check for the IdentiferInfoLookup object (the
regular StringMap lookup does enough work to mitigate the impact of
an extra null pointer check).
- The upshot is that now that some IdentifierInfo objects might be
owned by the IdentiferInfoLookup object. This should be reviewed.

PTH:
- Modified PTHManager::GetIdentifierInfo to *not* insert entries in
IdentifierTable's string map, and instead create IdentifierInfo
objects on the fly when mapping from persistent IDs to
IdentifierInfos. This saves a ton of work with string copies,
hashing, and StringMap lookup and resizing. This change was
motivated because when processing source files in the PTH cache we
don't need to do any string -> IdentifierInfo lookups.
- PTHManager now subclasses IdentifierInfoLookup, allowing clients of
IdentifierTable to transparently use IdentifierInfo objects managed
by the PTH file. PTHManager resolves "string -> IdentifierInfo"
queries by doing a binary search over a sorted table of identifier
strings in the PTH file (the exact algorithm we use can be changed
as needed).

These changes lead to the following performance changes when using PTH on Cocoa.h:
- fsyntax-only: 10% performance improvement
- Eonly: 30% performance improvement


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
28396608ec20d44e9d1470e1ea51689bb504d0de 14-Jan-2009 Ted Kremenek <kremenek@apple.com> PTH:
- Use canonical FileID when using getSpelling() caching. This
addresses some cache misses we were seeing with -fsyntax-only on
Cocoa.h
- Added Preprocessor::getPhysicalCharacterAt() utility method for
clients to grab the first character at a specified sourcelocation.
This uses the PTH spelling cache.
- Modified Sema::ActOnNumericConstant() to use
Preprocessor::getPhysicalCharacterAt() instead of
SourceManager::getCharacterData() (to get PTH hits).

These changes cause -fsyntax-only to not page in any sources from
Cocoa.h. We see a speedup of 27%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f02f6f0ee3e05b958bcf67f00f4503671d67eccd 13-Jan-2009 Ted Kremenek <kremenek@apple.com> PTH: Fix remaining cases where the spelling cache in the PTH file was being missed when it shouldn't. This shaves another 7% off PTH time for -Eonly on Cocoa.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b70e3dafb9618f34017061400dc19ac5e3539a6d 08-Jan-2009 Ted Kremenek <kremenek@apple.com> PTH:
- Added stub PTHLexer::getSpelling() that will be used for fetching cached
spellings from the PTH file. This doesn't do anything yet.
- Added a hook in Preprocessor::getSpelling() to call PTHLexer::getSpelling()
when using a PTHLexer.
- Updated PTHLexer to read the offsets of spelling tables in the PTH file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e1dccaefe2d44a9f83f8c3f087438a3297254cac 05-Jan-2009 Chris Lattner <sabre@nondot.org> simplify Preprocessor::getSpelling now that identifiers carry around
their length.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
86bc6cf05ad3ff7198671c394ba5157974e8a39c 25-Dec-2008 Steve Naroff <snaroff@apple.com> Add parser support for __forceinline, __w64, __ptr64.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
239f07384fe5e7194e780d98a17553084efeeb44 25-Dec-2008 Steve Naroff <snaroff@apple.com> Add parser support for __cdecl, __stdcall, and __fastcall.
Change preprocessor implementation of _cdecl to reference __cdecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f59e17ecf06ac60065e2d02058bd6f21f5d216cc 24-Dec-2008 Steve Naroff <snaroff@apple.com> Add explicit "fuzzy" parse support for Microsoft declspec.
Remove previous __declspec macro that would effectively erase the construct prior to parsing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
7e0fbb2561fadf8c1fce5fdb588f5db2f3cae51f 18-Dec-2008 Steve Naroff <snaroff@apple.com> Don't define __STDC__ when compiling with -fms-extensions


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0ea76727ae91bca918a8414ed85b530eddcfedeb 15-Dec-2008 Ted Kremenek <kremenek@apple.com> Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c1571453de3db2b26c15cc13115fac4ece84aa7c 01-Dec-2008 Daniel Dunbar <daniel@zuster.org> Add LangOptions marker for assembler-with-cpp mode and use to define
__ASSEMBLER__ properly. Patch from Roman Divacky (with minor
formatting changes). Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
adc4eeb08042a35ae914fc557ffec0cef3df2374 22-Nov-2008 Chris Lattner <sabre@nondot.org> Move the Preprocessor::Diag methods inline. This has the interesting
(and carefully calculated) effect of allowing the compiler to reason
about the aliasing properties of DiagnosticBuilder object better,
allowing the whole thing to be promoted to registers instead of
resulting in a ton of stack traffic.

While I'm not very concerned about the performance of the Diag() method
invocations, I *am* more concerned about their code size and impact on the
non-diagnostic code. This patch shrinks the clang executable (in
release-asserts mode with gcc-4.2) from 14523980 to 14519816 bytes. This
isn't much, but it shrinks the lexer from 38192 to 37776, PPDirectives.o
from 31116 to 28868 bytes, etc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
9efe9709287801562a3cbe1e5f3ab5dd8175c25b 22-Nov-2008 Chris Lattner <sabre@nondot.org> inline a method into its only two call sites.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3cbfe2c4159e0a219ae660d50625c013aa4afbd0 22-Nov-2008 Chris Lattner <sabre@nondot.org> Split the DiagnosticInfo class into two disjoint classes:
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.

There is no functionality change with this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
1a531570d294ffc300cce1bc5e73de847a370f4f 19-Nov-2008 Ted Kremenek <kremenek@apple.com> Move more cases of using 'CurLexer' to 'CurPPLexer'.
Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59671 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
fad03b2b38a3baea4b67e79e676fee15078e3258 19-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove Preprocessor::CacheTokens boolean data member. The same functionality can be provided by using Preprocessor::isBacktrackEnabled().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
4b71e3e439080e69cd369313bf2ad2c85bac8267 19-Nov-2008 Ted Kremenek <kremenek@apple.com> Initialize CurPPLexer in Preprocessor's constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59573 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
204b2fed909b1eabea7aeb6caadd7cff718edee5 18-Nov-2008 Chris Lattner <sabre@nondot.org> Remove the last of the old-style Preprocessor::Diag methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3692b09faa9fe346f39bc922db6dce48cdcc3f63 18-Nov-2008 Chris Lattner <sabre@nondot.org> Convert the lexer and start converting the PP over to using canonical Diag methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0a14eee528a901c16f0e288fbc10a3abc1660d87 18-Nov-2008 Chris Lattner <sabre@nondot.org> This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed. In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a
ton of random stuff. This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how
Diagnostic::Report works. Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and
ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator. When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information. This is a somewhat tricky dance, but it means that the
accumulated DiagnosticInfo is allowed to keep pointers to other expression
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema. For example, instead of calling:

Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

Diag(BuiltinLoc, diag::err_overload_no_match)
<< typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just
strings) in a type-safe way. Go operator overloading?!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2383b7f6aea2cb2bf2b5bfc0ec730f9354fecbbf 18-Nov-2008 Chris Lattner <sabre@nondot.org> Change the diagnostics interface to take an array of pointers to
strings instead of array of strings. This reduces string copying
in some not-very-important cases, but paves the way for future
improvements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
caaa7df2c78bbd40197823034c0275f3dcbd63e7 13-Nov-2008 Ted Kremenek <kremenek@apple.com> Using llvm::OwningPtr<> for CurLexer and CurTokenLexer. This makes both the ownership semantics of these objects explicit within the Preprocessor and also tightens up the code (explicit deletes not needed).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
73608a89a64401985990f8046f75cdd82309e92f 31-Oct-2008 Sanjiv Gupta <sanjiv.gupta@microchip.com> Fixed build warning. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
31fc07df7f0fc89ebf83ca05a20b29de45a7598d 31-Oct-2008 Sanjiv Gupta <sanjiv.gupta@microchip.com> Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wchar
etc more generic. For some targets, long may not be equal to pointer size. For
example: PIC16 has int as i16, ptr as i16 but long as i32.

Also fixed a few build warnings in assert() functions in CFRefCount.cpp,
CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
eb52b44caf9afbf4bfaf0e3e6f9426d90492b85b 06-Oct-2008 Chris Lattner <sabre@nondot.org> __CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTR
won't expand to the builtin. This fixes rdar://6248329



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
12f09260294175dc097b843d3d06d048b9cd64a3 05-Oct-2008 Chris Lattner <sabre@nondot.org> move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ into
target indep code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e9863cab04789cd6d82453c42f6736624e0e739b 05-Oct-2008 Chris Lattner <sabre@nondot.org> suck the rest of the FP macros out of the targets into the PP


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2db78dd977fbba8fdf24cf8a4593436c031cfbcb 05-Oct-2008 Chris Lattner <sabre@nondot.org> start moving fp macros over


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0e5d4ef3155651af17a90fdc07d9f80b33935c0c 05-Oct-2008 Chris Lattner <sabre@nondot.org> move a bunch more integer sizing out of target-specific code into
target indep code.

Note that this changes functionality on PIC16: it defines __INT_MAX__
correctly for it, and it changes sizeof(long) to 16-bits (to match
the size of pointer).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57132 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
9b533164570a67c81ad49f3691f02608530a042e 05-Oct-2008 Chris Lattner <sabre@nondot.org> eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
integer size #defines over to the Preprocessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57130 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2b43ad9588b8c7f0c9fdc1d95f4f972257215fca 05-Oct-2008 Chris Lattner <sabre@nondot.org> gcc no longer defines __block to nothing when blocks aren't enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
62213d90822848110e5f4125491351697d5a302c 05-Oct-2008 Chris Lattner <sabre@nondot.org> rearrange preprocessor macro definitions into language-specific
then target specific.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
3fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99 05-Oct-2008 Chris Lattner <sabre@nondot.org> Implement PR2773, support for __USER_LABEL_PREFIX__


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
048dd943fc22a3ee60180d6992d744106c4c100a 30-Sep-2008 Chris Lattner <sabre@nondot.org> define __PASCAL_STRINGS__ whenever -fpascal-strings is enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
71af22964535d66b656b4c2de3551bf770e4164d 30-Sep-2008 Chris Lattner <sabre@nondot.org> __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is a darwin-specific #define



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
721818304ac462d8c6ce05eecd02884033db78f1 26-Sep-2008 Chris Lattner <sabre@nondot.org> Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfo
to whether the fileid is a 'extern c system header' in addition to whether it
is a system header, most of this is spreading plumbing around. Once we have that,
PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to
base the system header state on FileIDInfo instead of HeaderSearch. Finally,
in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness
of a file being entered can be set due to the #includer or the #includee.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
38a67c9dfb23f6bc18ac2423b1e72efe8a22cc56 26-Sep-2008 Daniel Dunbar <daniel@zuster.org> Update clang to pretend to be gcc-4.2.
- This really needs to be automated and configurable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
dca6d6e8b0868e8baf727bf13df12e6d83d2828f 23-Sep-2008 Steve Naroff <snaroff@apple.com> Fix <rdar://problem/6240065> clang: __BLOCKS__ should be defined.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
b4eaf9cf5f79c86a3f7564f4dfdea57f165ca45c 02-Sep-2008 Steve Naroff <snaroff@apple.com> - Implement __block.
- Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
c9a4eea59228bd06072927059979a1c9ccab45b5 02-Sep-2008 Steve Naroff <snaroff@apple.com> Pull code from last commit. will put back soon.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
042f955a20e67cd8c8cdfede96bc6ec5a7234294 02-Sep-2008 Steve Naroff <snaroff@apple.com> Implement block pseudo-storage class modifiers (__block, __byref).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
2174a4ff834b72c0a0e3f24e4b62123f30f4cce6 23-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a safety check.
Make sure there's no "dangling" backtrack position when Preprocessor is destroyed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
fba5cb12adbe95d79855e91db018b863ce48387e 12-Aug-2008 Daniel Dunbar <daniel@zuster.org> Move some ObjC preprocessor definitions into
InitializePredefinedMacros().
- Also now properly wired to -fobjc-gc, -fnext-runtime.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
de9d55a0dbee338bd4aed8764dd9b998c9f48200 12-Aug-2008 Chris Lattner <sabre@nondot.org> remove obsolete comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
7bfaaaecb3113f955db31e8d8a51acffd1bc0c27 10-Aug-2008 Nico Weber <nicolasweber@gmx.de> * Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now
empty class TextDiagnostic
* Make DiagClient optional for Diagnostic

This fixes the following problems:

* -html-diags (and probably others) does now output the same set of
warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on
TextDiagnostic
* some code duplication is removed




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
03db1b31dd926409b7defc1c90b66549464652c0 10-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow the preprocessor to cache the lexed tokens, so that we can do efficient lookahead and backtracking.

1) New public methods added:
-EnableBacktrackAtThisPos
-DisableBacktrack
-Backtrack
-isBacktrackEnabled

2) LookAhead() implementation is replaced with a more efficient one.
3) LookNext() is removed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54611 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
109949a5f5f8c1e9f917095706639167cfe9260f 19-Jul-2008 Ted Kremenek <kremenek@apple.com> Patch by

"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53796 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
551d5e9811c0e68496bb2842163c6d99138d6ef9 05-Jul-2008 Nuno Lopes <nunoplopes@sapo.pt> move the linux predefined macro definition to the TargetInfo, where it really belongs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
e8825aa06c88818c9e35b3411601540ea1ae9d4a 05-Jul-2008 Nuno Lopes <nunoplopes@sapo.pt> predefine the macro linux when compiled on a linux system. this fixes the build of libtidy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
d86522a2c7722b85cac070178b6590093dd9d827 26-Jun-2008 Chris Lattner <sabre@nondot.org> clang uses the llvm backend, so define __llvm__ like llvm-gcc.
Additionally, define __clang__ so clients can predicate based on
clang features.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
73b17cd017f70d0bf7ca2dbb12f09f99081d7fdb 15-May-2008 Steve Naroff <snaroff@apple.com> Fix rewriter bug <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C".

Have clang predefine OBJC_NEW_PROPERTIES (which is what gcc does).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
0c7e8058deab0516923bcc070ae49b35e005b8e0 09-May-2008 Steve Naroff <snaroff@apple.com> DO NOT pre-defined __OBJC2__. The __OBJC2__ macro should only be defined when targeting the new, Apple 2.0 *runtime ABI*. It is not intended to be used to #ifdef ObjC 2.0 langauge features. This is unfortunate (given it's name). In a perfect world, this defined would be named __OBJC2_RUNTIME_ABI__. Oh well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50913 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
8ed3044a33679cbfa0617d465a50ec557d671ed7 05-May-2008 Chris Lattner <sabre@nondot.org> Neil pointed out that clang doesn't generate ranges from diagnostics
related to pp-expressions. Doing so is pretty simple and this
patch implements it, yielding nice diagnostics like:

t.c:2:7: error: division by zero in preprocessor expression
#if 1 / (0 + 0)
~ ^ ~~~~~~~
t.c:5:14: error: expected ')' in preprocessor expression
#if (412 + 42
~~~~~~~~^
t.c:5:5: error: to match this '('
#if (412 + 42
^
t.c:10:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
~~~ ^ ~~
t.c:10:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
~~~~~~~~~~ ^ ~~
5 diagnostics generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
aa39197431a0a0b1326ecf6b3be6a11f6e2f8503 20-Apr-2008 Chris Lattner <sabre@nondot.org> simplify ownership of the predefines buffer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
339b9c27759d7b6a53e2370f83f66e78b3254595 18-Apr-2008 Ted Kremenek <kremenek@apple.com> class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.

clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
passes it to the preprocessor object.

clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
ec6c574478a22008847d7ebc2498ef3336752096 17-Apr-2008 Ted Kremenek <kremenek@apple.com> Added "PreprocessorFactory", an interface for lazily creating Preprocessor objects on-demand.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
f90a24857851f7d28797205c810aae1708eaa60c 18-Mar-2008 Chris Lattner <sabre@nondot.org> move #include to the file that needs it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/Preprocessor.cpp
bda0b626e74513950405c27525af87e214e605e2 16-Mar-2008 Chris Lattner <sabre@nondot.org> Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it. This follows the main
llvm tree, and allows the libraries to be built in parallel. The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in. This speeds
up parallel builds, particularly incremental ones.


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