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

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

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Lex/PPDirectives.cpp
26297f57634994b4ae47a0774c372d6944265bb2 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> When we hit a #include directive that maps to a module import, emit a token
representing the module import rather than making the module immediately
visible. This serves two goals:
* It avoids making declarations in the module visible prematurely, if we
walk past the #include during a tentative parse, for instance, and
* It gives a diagnostic (although, admittedly, not a very nice one) if
a header with a corresponding module is included anywhere other than
at the top level.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
974cbc5e43c4aeb9bf4a6bb7ed2718a20a910437 05-Nov-2013 David Majnemer <david.majnemer@gmail.com> Lex: Require that '#' be followed by a macro parameter name when preceded by '##'

After lexing a '##', we would look ahead and check to see if it was
followed by '__VA_ARGS__'. After doing so, we would then go ahead and
lex the token.

However we would fail in the case where the '##' was followed by a '#'
followed by an identifier because we would have lexed the '#' separately
from the identifier, bypassing our parameter validation logic.

Instead, lex the tokens coming after the '##' later.

This fixes PR17804.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
c641709607d45bf97772e925647db6c94866c50a 22-Oct-2013 Daniel Jasper <djasper@google.com> Allow a header to be part of multiple modules.

This patch changes two things:

a) Allow a header to be part of multiple modules. The reasoning is that
in existing codebases that have a module-like build system, the same
headers might be used in several build targets. Simple reasons might be
that they defined different classes that are declared in the same
header. Supporting a header as a part of multiple modules will make the
transistion easier for those cases. A later step in clang can then
determine whether the two modules are actually compatible and can be
merged and error out appropriately. The later check is similar to what
needs to be done for template specializations anyway.

b) Allow modules to be stored in a directory tree separate from the
headers they describe.

Review: http://llvm-reviews.chandlerc.com/D1951

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
9a17677bb8a332e873137187aba91f64d3fd16a0 26-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Per updates to D3781, allow underscore under ' in a pp-number, and allow ' in a #line directive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191443 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
ddd2dfc1d3f4a36cbe8cd775c588623a17049f9f 24-Sep-2013 Daniel Jasper <djasper@google.com> Module use declarations (II)

Review: http://llvm-reviews.chandlerc.com/D1546.

I have picked up this patch form Lawrence
(http://llvm-reviews.chandlerc.com/D1063) and did a few changes.

From the original change description (updated as appropriate):
This patch adds a check that ensures that modules only use modules they
have so declared. To this end, it adds a statement on intended module
use to the module.map grammar:

use module-id

A module can then only use headers from other modules if it 'uses' them.
This enforcement is off by default, but may be turned on with the new
option -fmodules-decluse.

When enforcing the module semantics, we also need to consider a source
file part of a module. This is achieved with a compiler option

-fmodule-name=<module-id>.

The compiler at present only applies restrictions to the module directly
being built.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
24146975f1af8c1b4b14e8545f218129d0e7dfeb 22-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Split isFromMainFile into two functions.

Basically, isInMainFile considers line markers, and isWrittenInMainFile
doesn't. Distinguishing between the two is useful when dealing with
files which are preprocessed files or rewritten with -frewrite-includes
(so we don't, for example, print useless warnings).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
0189fd61ec72d86e008aa5615be80581f84cf703 20-Jul-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Added preproc callback for pragma directives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
6a04b5e8c4f15c724b8b89a9c0ea702586ad1852 18-Jul-2013 John Thompson <John.Thompson.JTSoftware@gmail.com> Add condition expression result to if and elif callbacks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
bd89fdcbe6ad28d5052ec7295d4afefeaf4a4135 09-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't give # and ## special treatment when in -traditional-cpp mode. Patch by
Austin Seipp!


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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
995544ef901f70589025c278e112547966a1df09 18-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Make sure the assembler-with-cpp hack for "#" works with multiple "#"s in
succession. Fixes PR16363.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
4196019db7a9b22d09c31a290c49d45eab2fa1d3 16-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'
and a '!defined(X)' if we find a broken header guard. This is suboptimal; we
should point the diagnostic at the 'X' token not the 'if' token, but it fixes
the crash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
671538e8a51eab5bd65a1f9f327ba7f44f84e486 12-Jun-2013 Richard Trieu <rtrieu@google.com> Introducing -Wheader-guard, a warning that checks header guards actually work
properly. This warning checks that the #ifndef and #define directives at
the beginning of a header refer to the same macro name. Includes a fix-it
hint to correct the header guard.


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

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

Fixes rdar://13953768

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

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

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
ec27608da7f15b265135f5743fe71da1f8e25ee9 10-Apr-2013 Michael Ilseman <milseman@apple.com> Improve the diagnostics of the number-reading preprocessor directives.

The GNU line marker directive was sharing code with the #line directive, but some of the warnings/errors were reporting as #line directive diagnostics in both cases.

Previously:
#line 11foo1 ==> "#line directive requires a simple digit sequence"
# 11foo1 ==> "#line directive requires a simple digit sequence"

Now, we get:
#line 11foo1 ==> "#line directive requires a simple digit sequence"
# 11foo1 ==> "GNU line marker directive requires a simple digit sequence"




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
bd25ff8632e18bb3af761369fd3b0f1b48fdf061 03-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Allow comparing two macro definitions syntactically instead of only lexically.

Syntactically means the function macro parameter names do not need to use the same
identifiers in order for the definitions to be considered identical.

Syntactic equivalence is a microsoft extension for macro redefinitions and we'll also
use this kind of comparison to check for ambiguous macros coming from modules.

rdar://13562254

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
baa74bd3968028d8e5b10ee9b50d0dceb41e85a9 22-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] When a MacroInfo object is deserialized, allocate and store its submodule ID.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
abc0bea57d4e659d5cde178a4bb426acc48f999e 19-Mar-2013 David Blaikie <dblaikie@gmail.com> PR15539: Record "evaluating if/elif condition" flag in the right place

The previous implementation missed the case where the elif condition was
evaluated from the context of an #ifdef that was false causing PR15539.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
eed55e6061768c0faff62dda22c6edad9d286501 06-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> After issuing a diagnostic for undefining or redefining a builtin macro,
continue parsing the directive rather than silently discarding it.

Allowing undef or redef of __TIME__ and __DATE__ is important to folks
who want stable, reproducible builds.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
c7d1ca52ae1f33a105ad1be217304f74a34c45f3 22-Feb-2013 Jordan Rose <jordan_rose@apple.com> Preproceessor: fix #if skipping under -traditional-cpp.

When parsing directives within skipped #if blocks, we don't want to retain
any whitespace. Previously we were just skipping comments, but it's not
possible to skip comments and retain other whitespace. This change matches
the usual behavior for parsing directives (i.e. the behavior outside of
skipped #if blocks).

<rdar://problem/13267695>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
6aad4a31b35df07fe818f193fcfd3c0197aea467 21-Feb-2013 Jordan Rose <jordan_rose@apple.com> Preprocessor: preserve whitespace in -traditional-cpp mode.

Note that unlike GNU cpp we currently do not preserve whitespace in macros
(even in -traditional-cpp mode).

<rdar://problem/12897179>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
3f6f51e28231f65de9c2dd150a2d757b2162cfa3 08-Feb-2013 Jordan Rose <jordan_rose@apple.com> Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.

Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
1b58c74af272a1d8228b8161c93a8a018456098e 08-Feb-2013 Douglas Gregor <dgregor@apple.com> Teach subframework header lookup to suggest modules <rdar://problem/13176200>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
1ea6bc0fd9c1ff9fa03e8a829a79c4167445d503 25-Jan-2013 Daniel Dunbar <daniel@zuster.org> [Lex] Remove DirectoryLookup.UserSpecified, which is unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173409 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
617bb317a7aeb6c3468a4170a5d6c1058da7cea1 17-Jan-2013 Joey Gouly <joey.gouly@arm.com> Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not supported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
36845474e217b952c720f4f87923bc78059640c5 16-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Call the MacroUndefined callback even when the macro was not defined.

Patch by Enea Zaffanella!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172623 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
80ad52f327b532bded5c5b0ee38779d841c6cd35 02-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> s/CPlusPlus0x/CPlusPlus11/g


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
61c1c8ee3fa1bd1f4866d246c72af854be834634 08-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Preprocessor] Enhance Ifdef/Ifndef/Defined preprocessor callbacks to also pass
a MacroInfo object if the identifier was a macro name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
463d90986ec54c62bf8fe31193ef5db701db48a5 30-Nov-2012 Douglas Gregor <dgregor@apple.com> Keep track of modules that have failed to build. If we encounter an
import of that module elsewhere, don't try to build the module again:
it won't work, and the experience is quite dreadful. We track this
information somewhat globally, shared among all of the related
CompilerInvocations used to build modules on-the-fly, so that a
particular Clang instance will only try to build a given module once.

Fixes <rdar://problem/12552849>.




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

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

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

<rdar://problem/12292192>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
cfa1caa92611184f59c2f3e606c53ddcc726449a 01-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make the FilenameRange of the InclusionDirective callback more accurate,
preserve the macro location of the range end if the filename came from a macro.

Patch by Kim Gräsman!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.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/PPDirectives.cpp
eb788e9b49d55bbbc661f1a9db8a54525ecdd0bc 29-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add an assertion to make sure the implicitly imported module
is the same as the suggested one when looking up the include filename.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
da313592441db36cf4b06be97c4bcc238ee6fa9c 27-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Per discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html
have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets.

rdar://11113134 & http://llvm.org/PR13880

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164743 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
59cabd7101d3871519019efdff008378a985dae9 11-Sep-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] Fix getting a cursor inside an angled #include directive.

Fixed by pointing the end location of the preprocessed entity for the #include
at the closing '>', instead of the start of '<'.

rdar://11113134

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e40c4238a572bf8241a04e0005f70550cbfc1cfb 29-Aug-2012 Alexander Kornienko <alexfh@google.com> Fixed a problem with #pragma push_macro/pop_macro implementation.

Summary:
The problem was with the following sequence:
#pragma push_macro("long")
#undef long
#pragma pop_macro("long")
in case when "long" didn't represent a macro.
Fixed crash and removed code duplication for #undef/pop_macro case. Added regression tests.

Reviewers: doug.gregor, klimek

Reviewed By: doug.gregor

CC: cfe-commits, chapuni

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

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

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

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

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

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

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

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


Reviewers: doug.gregor, klimek, rsmith, djasper

Reviewed By: doug.gregor

CC: cfe-commits, chandlerc

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
a52f5a3ee2156849b3b91255c360b9f0bb1ebd51 18-Jul-2012 Aaron Ballman <aaron@aaronballman.com> Adding a fixit for includes that cannot be found with angle brackets, but can be found with quoted strings instead. Implements PR13201.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160406 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
540f9ae1023bba27052c742cd92d0b32361b28eb 26-Jun-2012 Fariborz Jahanian <fjahanian@apple.com> preprocessing: gcc supports #line 0. So, treat this
as a gcc supported extension with usual treatment
with -pedantic (warn) and -pedantic-errors (error).
// rdar://11550996


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
bc9e5582467e70ec38b9fc5d3605152e86e2a5f8 25-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add testing for CommentHandler, and fix a bug where trailing comments in #else
and #endif in non-skipped blocks were not passed to the CommentHandler. Patch
by Andy Gibbs!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159119 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
dc20169f3869ec7f4bfd4e62e81a21b4cb49e34d 22-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup:
* Add \brief summaries;
* Escape # characters in Doxygen comments;
* Add \code...\endcode markup for code examples;
* Add \verbatim...\endverbatim markup for grammar productions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
986f317944658ecb1c8c279c1c8a0079396d42bf 21-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Do not complain about junk on the end of a #endif in a skipped block. Such junk
is permitted by all relevant language standards. Patch by Andy Gibbs!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
3093b20d824a953d8bc7a786dd952414898f8d6d 18-May-2012 Benjamin Kramer <benny.kra@googlemail.com> Lexer::ReadToEndOfLine: Only build the string if it's actually used and do so in a less malloc-intensive way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e2e8768c290ceceb3ac2e369b5243f40d6c0e3e2 31-Mar-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed MacroInfo definition range for function like macros with empty body.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
db81d38d9cd468a9eeffe8ab092be4d48e43888e 27-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Handle correctly inclusion directives that have macro expansions, e.g
"#include MACRO(STUFF)".

-As an inclusion position for the included file, use the file location of the file where it
was included but *after* the macro expansions. We want the macro expansions to be considered
as before-in-translation-unit for everything in the included file.

-In the preprocessing record take into account that only inclusion directives can be encountered
as "out-of-order" (by comparing the start of the range which for inclusions is the hash location)
and use binary search if there is an extreme number of macro expansions in the include directive.

Fixes rdar://11111779

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
4207edaf03da28fa917a94b31c5c1eef0e6417dc 18-Mar-2012 Aaron Ballman <aaron@aaronballman.com> Turns #import in MS Mode into an error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
99831e4677a7e2e051af636221694d60ba31fcdb 06-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The
two constructs are still represented by the same TokenKind, in order to prevent
a combinatorial explosion of different kinds of token. A flag on Token tracks
whether a ud-suffix is present, in order to prevent clients from needing to look
at the token's spelling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
bb660666883de8b32999c1e5fbe3c32e2cafbdf6 05-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Enhance the preprocessor callbacks:

-Add location parameter for the directives callbacks
-Skip callbacks if the directive is inside a skipped range.
-Make sure the directive callbacks are invoked in source order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
4c55c54db8e676aa3e042188773d9d82d59fff91 02-Mar-2012 Aaron Ballman <aaron@aaronballman.com> Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
10285d9113c14d1e523f86a55b193eb752638ea5 01-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Revert r151800, which was committed without review and has correctness issues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151804 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
7abe1666f225b6d1a11aa7ed19d9a0dcc49391cb 01-Mar-2012 Aaron Ballman <aaron@aaronballman.com> Implements support for #pragma include_alias in ms compatibility mode. Fixes PR10705.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
07a4b0488b03fc1590326ab7c812627a546feb14 01-Mar-2012 Nico Weber <nicolasweber@gmx.de> Move suport for redefining operator keywords from -fms-extensions to -fms-compatibility.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
f4fb07ed4dfd144a39d904fc77b3b0bab580eb2e 29-Feb-2012 Nico Weber <nicolasweber@gmx.de> Allow operator keywords to be #defined in ms-ext mode.

Fixes PR10606.

I'm not sure if this is the best way to go about it, but
I locally enabled this code path without the msext conditional,
and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp
which explicitly checks that operator keywords can't be redefined.

I also parsed chromium/win with a clang with and without this patch.
It introduced no new errors, but removes 43 existing errors.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
34a2c42ba8cc58a404238a3c1cbc4a7442e57832 02-Feb-2012 Ted Kremenek <kremenek@apple.com> Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149566 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
7530c034c0c71a64c5a9173206d9742ae847af8b 17-Jan-2012 David Blaikie <dblaikie@gmail.com> Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
1ac13c37d8af0145b7e03fea70b7b1476b8828c9 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Re-uglify #public and #private to #__public_macro and #__private_macro.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
94ad28b31433058445a27db722f60402ee820bea 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Under -fmodules, accept #public <macroname> and #private <macroname>
to make a macro public (the default for headers) or private,
respectively.


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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
a3ca4d655974ad66e432a6c78dd08b277a639edf 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Don't allow #include (and its friends #import, #include_next and
#__include_macros) in the arguments of a function-style macro. Directives in the
arguments of such macros have undefined behaviour, and GCC does not correctly
support these cases. In some situations, this can lead to better diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
5e3f9223db88227d6d21679c613b139d8160186d 08-Dec-2011 Douglas Gregor <dgregor@apple.com> Keep track of import dependencies between submodules within the module
that's currently being built. This is important for supporting
transitive dependencies ("export *" in the module map) completely.


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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
4b7cac5d04dba8a6cda46ba05d6a79218557aa94 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Note that we'll need to handle __include_macros specially in the module loader

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
8cfbe6a31ad51cb19046607ad6b792638e69b88e 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Move the module auto-import logic after the logic that allows a
callback client to suggest an alternative search path and after we
complain when the included file can't be found. The former can't be
tested in isolation, the latter doesn't actually matter (because we
won't make a module suggestion if no header is available). However,
the flow is better this way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
edee9699964a1f38892c74acc555883bf26b51a3 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Trivial indentation fix for the code I just committed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e3a8256a9c1f2f1037fcb844ed7666759124a852 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Introduce an opt-in warning indicating when the compiler is treating
an #include/#import as a module import.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
1c2e9332fa69727425a3a2b912e36e2ab62083f8 20-Nov-2011 Douglas Gregor <dgregor@apple.com> Allow preprocessor callbacks to recover from a "file not found" error,
from Jason Haslam!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145012 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
c69c42e939e6bdaa56d162cc36da4f6b6c53e8db 17-Nov-2011 Douglas Gregor <dgregor@apple.com> When making a suggestion regarding which module to load rather than
preprocess/parse a header, report back with an actual module (which
may be a submodule) rather than just the name of the module.


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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
661a99690bc133bbaa029da925481d4a860dec90 15-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat warnings for the lexer.

This also adds a -Wc++98-compat-pedantic for warning on constructs which would
be diagnosed by -std=c++98 -pedantic (that is, it warns even on C++11 features
which we enable by default, with no warning, in C++98 mode).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
158ebfba7545b3a9947f87bed83ea710df95ac3d 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> A couple random preprocessor changes that got ported from C99 to C++11.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
8dfac0baaf0f81d3945bcb306480e358ba8d1f08 30-Sep-2011 John McCall <rjmccall@apple.com> Add explicit attributes to mark functions as having had their
CoreFoundation object-transfer properties audited, and add a #pragma
to cause them to be automatically applied to functions in a particular
span of code. This has to be implemented largely in the preprocessor
because of the requirement that the region be entirely contained in
a single file; that's hard to impose from the parser without registering
for a ton of callbacks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140846 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
6b4ff04dd22e7159887ea6c1bb8b1c01fc9c70a9 27-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a callback to PPCallbacks for lines skipped by the preprocessor.

Patch by Jason Haslam!

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
f84139a1331c63c998e8b7d54148c75ac0b48ccd 31-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Change err_pp_file_not_found back to an Error; when it's a Warning, we suppress it in system headers. And it is not a good idea to suppress it in system headers. (This was originally changed in r134996 to implement -MG.)

Fixes <rdar://10041960>. And also brings down the number of warnings without a flag by one :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
70c7b10c64beed3e08da004c10ed5170c00df8f9 22-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Don't warn on varaidic macros in C++0x mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
5cee1195584fa8672253139c86e922daeda69b9e 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Add support for C++0x unicode string and character literals, from Craig Topper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e7b2b6e87dbe5b1207f77b6ff9c210a02f95bb39 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
bb52786da8d055568eef6e5694288c1258bc8c2a 12-Jul-2011 Peter Collingbourne <peter@pcc.me.uk> Implement -MG. Fixes PR9613

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
1f8dcfca6c57606b9f4f96404642c02562289b83 11-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn for unused macro when undef'ing it, if it comes from an included file. rdar://9745065

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
d57b7ff9bebc4c45f325fc1be6f238cfcd4c3732 30-Jun-2011 Peter Collingbourne <peter@pcc.me.uk> Replace an unreachable error path with an assert
(SourceManager::createFileID cannot return an invalid file ID).
Also update a comment to reflect this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
65aa6885818d4b4eea2e5a9d12085b2398148662 21-Jun-2011 Jay Foad <jay.foad@gmail.com> Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e26224e61c8a3b607c73c52f2cd0344065d7b412 21-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Only ignore extra tokens after #else if we skip it, otherwise warn. Fixes rdar://9475098.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
7412494982c8b50c90961302c3a718633b2c3ab7 26-Apr-2011 Manuel Klimek <klimek@google.com> To be able to replay compilations we need to accurately remodel how
includes get resolved, especially when they are found relatively to
another include file. We also try to get it working for framework
includes, but that part of the code is untested, as I don't have a code
base that uses it.

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
b5142bb7af5c70fffd09f05172a1379a35a9c29a 16-Mar-2011 Chandler Carruth <chandlerc@gmail.com> Add a 'RawPath' parameter to the PPCallbacks interface. This allows
clients to observe the exact path through which an #included file was
located. This is very useful when trying to record and replay inclusion
operations without it beind influenced by the aggressive caching done
inside the FileManager to avoid redundant system calls and filesystem
operations.

The work to compute and return this is only done in the presence of
callbacks, so it should have no effect on normal compilation.

Patch by Manuel Klimek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
84021556baceb76eedf7d44be8ba71d9b8cfacce 28-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> Rename tok::eom to tok::eod.

The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
a5ef584fd3d18da0c98342b4b6453948b7eb30d3 22-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> Reimplement __pragma support using a TokenLexer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126221 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
b2eb53d9fd973a1a02e05e67a3307b3efd12eff2 22-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> Make TokenLexer capable of storing preprocessor directive tokens

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
a33e0504f61132ac43f4f89af43b12c87e987c20 18-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> When redefining a macro don't warn twice if it's not used and don't warn for duplicate
definition by command line options. Fixes rdar://8875916.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
ba3ca5271a01eae7cbd6a19ace004d75012c02a8 06-Jan-2011 Chris Lattner <sabre@nondot.org> fix rdar://8823139, a crash on a comment in a preprocessed .s file
that contains the ## operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
3a1a8749cf6239f29e834f18a4e08638126678d9 03-Jan-2011 Chandler Carruth <chandlerc@gmail.com> Fix PR8654, ensuring each branch of an #if, #elif, #else, ... chain
receives a PPCallback.

Patch by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
c6ed729f669044f5072a49d79041f455d971ece3 23-Dec-2010 Jeffrey Yasskin <jyasskin@google.com> Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations. Fix one bug found by the warning, in which one
clang::OverloadCandidate constructor failed to initialize its
FunctionTemplate member.



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

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

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

Fixes rdar://8365684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
25bb03bc0f2561e830d866d5905b20c5475d6762 10-Dec-2010 Douglas Gregor <dgregor@apple.com> Don't crash when code-completing after "#include <". It would be far
better to actually produce a decent set of completions by checking the
system include paths, but not today. Fixes PR8744.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
2aa9267cf193e5eceb9fd24a51b51c031b606fe9 19-Nov-2010 Craig Silverstein <csilvers2000@yahoo.com> Several PPCallbacks take an SourceLocation + IdentifierInfo, rather
than a Token that holds the same information all in one easy-to-use
package. There's no technical reason to prefer the former -- the
information comes from a Token originally -- and it's clumsier to use,
so I've changed the code to use tokens everywhere.

Approved by clattner


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
cb7b1e17b63967317ab5cc55682168cf0380519a 12-Nov-2010 Douglas Gregor <dgregor@apple.com> Make sure to always check the result of
SourceManager::getPresumedLoc(), so that we don't try to make use of
an invalid presumed location. Doing so can cause crashes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
08985b91e5a87e7731ba24c675f2dc9f9cb645d4 06-Nov-2010 Craig Silverstein <csilvers2000@yahoo.com> Add PPCallbacks for #if/#ifdef/etc.

The callback info for #if/#elif is not great -- ideally it would give
us a list of tokens in the #if, or even better, a little parse tree.
But that's a lot more work. Instead, clients can retokenize using
Lexer::LexFromRawLexer().

Reviewed by nlewycky.


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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
52a4ff6eae5d5e303c8b43022211e6d3ed429254 19-Oct-2010 Ted Kremenek <kremenek@apple.com> Revert most of r116862. It isn't quite the right fix for a memory leak in Preprocessor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
ea35f7775fc83bc7d2756192e639cadc682adc16 19-Oct-2010 Ted Kremenek <kremenek@apple.com> Really fix: <rdar://problem/8361834> MacroInfo::AddTokenToBody() leaks memory

The problem was not the management of MacroInfo objects, but that when we recycle them
via the MICache the memory of the underlying SmallVector (within MacroInfo) was not getting
released. This is because objects stashed into MICache simply are reused with a placement
new, and never have their destructor called.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
80c60f72848896f867f6b7e664e7060d9e78f019 10-Sep-2010 Douglas Gregor <dgregor@apple.com> When we parse a pragma, keep track of how that pragma was originally
spelled (#pragma, _Pragma, __pragma). In -E mode, use that information
to add appropriate newlines when translating _Pragma and __pragma into
#pragma, like GCC does. Fixes <rdar://problem/8412013>.


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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111954 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
a7e6845660f91ec611427e1db842780e1ec12bdb 22-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Detabify.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
f47724bf78299c7a50f008e0443c5f9f9f279ddc 17-Aug-2010 Chris Lattner <sabre@nondot.org> Implement #pragma push_macro, patch by Francois Pichet!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
2d474ba9e8ae43a1a5a9f72718c0d79092b9453f 12-Aug-2010 Douglas Gregor <dgregor@apple.com> Don't emit end-of-file diagnostics like "unterminated conditional" or
"unterminated string" when we're performing code completion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110933 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
10fe93d57c11f068aa4d78eb4ca7f60329818306 08-Aug-2010 Douglas Gregor <dgregor@apple.com> Revert r110440, the fix for PR4897. Chris claims to have a better way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
2f05449fa1c9015a84b74c3308b856fc704662be 08-Aug-2010 Benjamin Kramer <benny.kra@googlemail.com> Push location through the MacroUndefined PPCallback and use it to print #undefs in -dD mode. (PR7818)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
91db30ad4a7bad37b57748c31f8b592b7bf7cbeb 06-Aug-2010 Douglas Gregor <dgregor@apple.com> Fix the #include search path when reading from stdin, from Jon Simons!
Fixes PR4897.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
6fbe3ebeaef08665a37423f8425314c90b8b5bcf 19-Apr-2010 Chris Lattner <sabre@nondot.org> add a PPCallback handler for a skipped #include, patch by
Zhanyong Wan!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101813 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
86d0ef74303e9164a0860ce849af597d34f937ab 14-Apr-2010 Chris Lattner <sabre@nondot.org> Improve line marker directive locations, patch by Jordy Rose


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
849b243d4065f56742a4677d6dc8277609a151f8 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Reinstate my CodeModificationHint -> FixItHint renaming patch, without
the C-only "optimization".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
275313cbb0847f1f117f60d144d113804d4fa42d 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Revert r100008, which inexplicably breaks the clang-i686-darwin10 builder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
d0ebe080eee7c37e73754068b47fd90cc506e128 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Rename CodeModificationHint to FixItHint, since we've been using the
term "fix-it" everywhere and even *I* get tired of long names
sometimes. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100008 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
453091cc2082e207ea2c2dda645a9bc01b37fb0c 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Audit all Preprocessor::getSpelling() callers, improving failure
recovery for those that need it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.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/PPDirectives.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/PPDirectives.cpp
13d283d6a2f50cc4a2b03357191d49672de0eb9b 12-Feb-2010 Chris Lattner <sabre@nondot.org> Fix PR6282: the include guard optimization cannot happen if the
guard macro is already defined for the first occurrence of the
header. If it is, the body will be skipped and not be properly
analyzed for the include guard optimization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95972 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
f45b646244705410866d62f1d8bf017a047ed662 22-Jan-2010 Chris Lattner <sabre@nondot.org> revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
2c6b193d574e0780ff0b8450ce1fde105f4881ac 18-Jan-2010 Chris Lattner <sabre@nondot.org> simplify the code for skipping in a #if 0 block. The CurLexer
pointer is always non-null because the PTH case exits earlier
in the method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
a139481e62fdb209d9d87a54a5733f989d2e8d51 10-Jan-2010 Chris Lattner <sabre@nondot.org> stringref'ize a bunch of filename handling logic. Much
nicer than passing around two const char*'s.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
c1abafc4fad5fc5ae0d428d0074495e3d2164f98 10-Jan-2010 Chris Lattner <sabre@nondot.org> clarify comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
804f65271953f358dc01bfcf74a93e8c93c5b2d6 10-Jan-2010 Chris Lattner <sabre@nondot.org> implement rdar://7520940: published framework headers should
import other headers within the same framework with the full
framework path, not with a relative include.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
b939a4e8b471f6a5e996fa57b2fd9df30b59cb60 31-Dec-2009 Benjamin Kramer <benny.kra@googlemail.com> Convert to StringRef, avoid a memcpy in the common case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
1d9c54df56391ac4740db27d551782e81189cb51 14-Dec-2009 Chris Lattner <sabre@nondot.org> formatting changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
39d9841ed4c0568d4b44dfbc12ac04491f60a374 01-Dec-2009 Chris Lattner <sabre@nondot.org> pass the reason for failure up from MemoryBuffer and report it
in diagnostics when we fail to open a file. This allows us to
report things like:

$ clang test.c -I.
test.c:2:10: fatal error: error opening file './foo.h': Permission denied
#include "foo.h"
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
6e2901407bff59aeb4cc301cc58b034723d0eb49 30-Nov-2009 Chris Lattner <sabre@nondot.org> Fix PR5633 by making the preprocessor handle the case where we can
stat a file but where mmaping it fails. In this case, we emit an
error like:
t.c:1:10: fatal error: error opening file '../../foo.h'

instead of "cannot find file".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
a28cc090f265d5bdaef9ebb24fb9d579928d3a18 30-Oct-2009 John Thompson <John.Thompson.JTSoftware@gmail.com> Re-arranged some internal functions for coming __has_include changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.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/PPDirectives.cpp
3d399a010102966158f6b69b07d636f113dc6ab4 13-Jul-2009 Daniel Dunbar <daniel@zuster.org> There is no need to value initialize this array.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
3240469102eca90fa5123ec9636fa0364df3034c 25-May-2009 Chris Lattner <sabre@nondot.org> Fix a couple of bugs:
1. When we accept "#garbage" in asm-with-cpp mode, change the token kind
of the # to unknown so that the preprocessor won't try to process it as
a real #. This fixes a crash on the attached example
2. Fix macro definition extents processing to handle #foo at the end of a
macro to say the definition ends with the foo, not the #.

This is a follow-on fix to r72283, and rdar://6916026


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
c25d8058958d9cda0d9d6216b475180ba2f7c71d 22-May-2009 Daniel Dunbar <daniel@zuster.org> In assembler-with-cpp mode, don't error on '#' (stringize) operator applied to
non-argument names, pass the tokens through.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
beaaccd8e2a8748f77b66e2b330fb9136937e14c 21-May-2009 Jay Foad <jay.foad@gmail.com> Use v.data() instead of &v[0] when SmallVector v might be empty.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
2451b528fe114595d0f10ef2c05047928558ab0f 21-Apr-2009 Chris Lattner <sabre@nondot.org> improve MacroInfo to track the source range of the macro definition,
patch by Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
41c17473e3ece9e60d97c5d9397866b7730cf7ee 21-Apr-2009 Chris Lattner <sabre@nondot.org> add a preprocessor callback function for #undef, patch by
Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
8fde5978a63bcce5c294a93b2a5dd424d7628971 19-Apr-2009 Chris Lattner <sabre@nondot.org> Fix PR4006, incorrect handling of __VA_ARGS__ when it was the first token
in a function-like macro body. This has the added bonus of moving some
function-like macro specific code out of the object-like macro codepath.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
dc8c90da158030c0d0c62539e2da0adccc09f271 18-Apr-2009 Chris Lattner <sabre@nondot.org> more fun with line markers: the digit string is required to be interpreted
as decimal, even if it starts with 0. Also, since things like 0x1 are
completely illegal, don't even bother using numericliteralparser for them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
bc81682756a2406e1788b14c576b3c8b515d97a3 18-Apr-2009 Chris Lattner <sabre@nondot.org> second half of PR3940: #line requires simple digit sequence.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
6272bcfe5dc148d293ccce9db19df9e71c991cde 18-Apr-2009 Chris Lattner <sabre@nondot.org> enforce requirements imposed by C90 6.8 TC1, fixing PR3919.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
8fe00e783eda289c28a25eea452fd4d467963a82 18-Apr-2009 Chris Lattner <sabre@nondot.org> Fix PR3938 by taking into account C99 6.10p4.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
9cb51ce03caf0755759f7e67aea7d4be684ff738 18-Apr-2009 Chris Lattner <sabre@nondot.org> Fix two problems from PR3916, and one problem I noticed while hacking
on the code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69404 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
58e91d57510a5ce4fd424fe7fd1cdfa86701ef35 18-Apr-2009 Chris Lattner <sabre@nondot.org> implement PR3940: #line numbers not fully checked


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
ab82f41b217ce588a9456c0b4411f219d3ed0df8 18-Apr-2009 Chris Lattner <sabre@nondot.org> #line is allowed to have macros that expand to nothing after them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
959875a66d74d38b8f2d499662afb142d249bf3e 14-Apr-2009 Chris Lattner <sabre@nondot.org> Offer a fixit hint for our warning about tokens at the end of a directive:

t.c:3:8: warning: extra tokens at end of #endif directive
#endif foo
^
//

Don't do this in strict-C89 mode because bcpl comments aren't
valid there, and it is too much trouble to analyze whether
C block comments are safe.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
35410d5cbbb18735d76e00496540d416dc49b577 14-Apr-2009 Chris Lattner <sabre@nondot.org> Fix the #import / #include_next "extra tokens at end of #foo directive"
Warning to properly report that it is an import/include_next instead of
claiming it is a #include.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
8533bd5a32a12c51341e82d2aef083acbac7c04c 13-Apr-2009 Daniel Dunbar <daniel@zuster.org> Fix assertion failure in PTH when tokens followed a closing #endif.
- Ted, please check.

- Missing test case because PTH won't reliably cache the tokens in a
test case. *cough*


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
f4a72b07747cd6ae1a9f6974e148ae504c879349 12-Apr-2009 Chris Lattner <sabre@nondot.org> add a ppcallback hook for macro definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
fd10511b3e686c5b045f8324b0632f3624d9ef05 08-Apr-2009 Chris Lattner <sabre@nondot.org> finish the implementation of -imacros. The driver still needs to be hooked up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
de076650fa79a02743b5fe57a72f991ba24779f9 08-Apr-2009 Chris Lattner <sabre@nondot.org> reject the #__include_macros directive unless it comes from the
predefines buffer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68627 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
b8e240ed8b8f58c7b7fe82776bd6147b437f5d53 08-Apr-2009 Chris Lattner <sabre@nondot.org> Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
16629386f1326608dc1ff9f4ff785fb3fae0bfb3 27-Mar-2009 Chris Lattner <sabre@nondot.org> push line markers through -E mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
42aa16cccb3d6cd4195ccff9c32d8cb50a25a094 18-Mar-2009 Chris Lattner <sabre@nondot.org> when preprocessing a .S file, unknown directives should just be passed through,
and the token after the # should be expanded if it is not a valid directive.
This allows us to transform things like:

#define FOO BAR
# FOO

into # BAR, even though FOO is not normally expanded for directives.

This should fix PR3833



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
5f607c4b75abeedded11eff079dee73561d98203 18-Mar-2009 Chris Lattner <sabre@nondot.org> This is not considered a preprocessor directive in .S files:
# 4



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
7f549dfd7b1d3b2b09e5878eeb754efae253d557 13-Mar-2009 Chris Lattner <sabre@nondot.org> use accessor instead of poking ivar directly


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66954 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
b627c8d683c4d3facd774c432b1fdc2d35819369 06-Mar-2009 Chris Lattner <sabre@nondot.org> #import is not considered an extension for ObjC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.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/PPDirectives.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/PPDirectives.cpp
be5c64d7a765acaf9454e7a511233771472bf811 04-Feb-2009 Chris Lattner <sabre@nondot.org> Fix PR3464 by searching for headers from the predefines
buffer as if the #include happened from the main file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63764 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
137b6a6149c53dbbcb8fba98e524d9ad0f3c8736 04-Feb-2009 Chris Lattner <sabre@nondot.org> Implement handling of file entry/exit notifications from GNU
line markers, including maintenance of the virtual include stack.

For something like this:

# 42 "bar.c" 1
# 142 "bar2.c" 1

#warning zappa
# 92 "bar.c" 2
#warning gonzo
# 102 "foo.c" 2
#warning bonkta


we now produce these three warnings:

#1:
In file included from foo.c:3:
In file included from bar.c:42:
bar2.c:143:2: warning: #warning zappa
#warning zappa
^

#2:
In file included from foo.c:3:
bar.c:92:2: warning: #warning gonzo
#warning gonzo
^

#3:
foo.c:102:2: warning: #warning bonkta
#warning bonkta
^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
9d79ebac47ffde6a1cb312f4c09b66b1b9a397fb 04-Feb-2009 Chris Lattner <sabre@nondot.org> propagate linemarker flags down into the the line table, currently
ignoring include stack push/pop info though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
4c4ea17d7f991516c37a871dfa4bbe5723fa85f0 03-Feb-2009 Chris Lattner <sabre@nondot.org> stub out basic #line handling calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.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/PPDirectives.cpp
202fd2c4fb8d98ea9990df9bc157b11bc26ac2fa 27-Jan-2009 Chris Lattner <sabre@nondot.org> Fix a bug that I noticed by inspection.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e7689886d6a68507ae90ca330bd24bf89d4d6df1 26-Jan-2009 Chris Lattner <sabre@nondot.org> remove my hacks that aggressively threw away multiple
instantiation history in an effort to speed up c99-intconst-1.c.
Now that multiple nested instantiations are allowed, we just
make them and don't pay the cost of lookups. With the other
changes that went in before this, reverting this is actually
a speedup for c99-intconst-1.c, speeding it up from 1.96s to 1.80s,
and preserves much better loc info.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
5b9a504720fb52594ca3686e10eb6c0cfa2e7d62 26-Jan-2009 Chris Lattner <sabre@nondot.org> start plumbing together the line table information. So far we just
unique the Filenames in #line directives, assigning them UIDs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
478a18ec47fdb7e0e580a2635648456e9db9ad4f 26-Jan-2009 Chris Lattner <sabre@nondot.org> add parsing and constraint enforcement for GNU line marker directives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
099dd05b579ccefa97bd4f4a3088d4c262f080e4 26-Jan-2009 Chris Lattner <sabre@nondot.org> a few minor cleanups


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
359cc4475487ea0a660b3e8918334a2866e71c66 26-Jan-2009 Chris Lattner <sabre@nondot.org> parse and enforce required constraints on #line directives. Right now
we just discard them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
9bd0d59026d4995148443512ab5ddf009117bfd8 26-Jan-2009 Chris Lattner <sabre@nondot.org> Eagerly resolve the spelling location of the tokens in a definition
of a macro. Since these tokens may themselves be from macro
expansions, we need to resolve down to the spelling loc when the
macro ends up being instantiated. Instead of resolving this for
each token expanded from the macro definition, just do it once when
the macro is defined. This speeds up clang on c99-intconst-1.c from
2.66s to 2.43s (9.5%), reducing the FileID lookups from 407244 linear and
114175649 binary to 2529040 linear and 64771121 binary.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
693faa6e6918994bc22aacf078a889bb93e0fe25 19-Jan-2009 Chris Lattner <sabre@nondot.org> do not use SourceManager::getFileCharacteristic(FileID), it is not
safe because a #line can change the file characteristic on a per-loc
basis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
41c3ae108a54437f27fa99ddcb9bafcf113bde80 16-Jan-2009 Chris Lattner <sabre@nondot.org> As a performance optimization, don't bother calling MacroInfo::isIdenticalTo
if warnings in system headers are disabled. isIdenticalTo can end up
calling the expensive getSpelling method, and other bad stuff and is
completely unneeded if the warning will be discarded anyway. rdar://6502956


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
e5680f3cd678014cf0872d34726dc804b0cbbdd4 23-Dec-2008 Ted Kremenek <kremenek@apple.com> PTH:
- Embed 'eom' tokens in PTH file.
- Use embedded 'eom' tokens to not lazily generate them in the PTHLexer.
This means that PTHLexer can always advance to the next token after
reading a token (instead of buffering tokens using a copy).
- Moved logic of 'ReadToken' into Lex. GetToken & ReadToken no longer exist.
- These changes result in a 3.3% speedup (-Eonly) on Cocoa.h.
- The code is a little gross. Many cleanups are possible and should be done.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
9485d2382c1e3833ccbed20a185f6ab96d4dd703 13-Dec-2008 Chris Lattner <sabre@nondot.org> eliminate the isCXXNamedOperator function and some string compares and
use identifierinfo instead. Patch by Chris Goller!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
268ee7016a2811803989487c0ad3799486092c63 12-Dec-2008 Ted Kremenek <kremenek@apple.com> Added PTH optimization to not process entire blocks of tokens that appear in skipped preprocessor blocks. This improves PTH speed by 6%. The code for this optimization itself is not very optimized, and will get cleaned up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60956 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
08631c5fa053867146b5ee8be658c229f6bf127c 23-Nov-2008 Chris Lattner <sabre@nondot.org> Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them. This has a bunch of follow-on
effects and requires tweaking to a whole lot of code. This causes
a regression in two tests (xfailed) by causing it to emit things like:

Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency. This is good, but I was planning to do this
as an independent patch. There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
81d24e135c60dcbe421864e6a4334ba99b8fe7ec 20-Nov-2008 Ted Kremenek <kremenek@apple.com> Rename IsNonPragmaNonMacroLexer to IsFileLexer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
ac80c6e06b5815228e46294e51c493a74a21f8bc 19-Nov-2008 Ted Kremenek <kremenek@apple.com> Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
17ff58a63197b398ae52697b088dc0fb8b255519 19-Nov-2008 Ted Kremenek <kremenek@apple.com> When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
41938c8493b4380df738263166b746eacb33c309 19-Nov-2008 Ted Kremenek <kremenek@apple.com> - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
(simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.
- Add 'FileID' to PreprocessorLexer, and have Preprocessor query this fileid
when looking up the FileEntry for a file

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
6cf3ed7be70a7a9c269a65e3316884f41c7373d4 19-Nov-2008 Chris Lattner <sabre@nondot.org> don't turn identifierinfo's into strings in diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
2df37b8eaecc5382e0e511a738f88918f48d9454 19-Nov-2008 Ted Kremenek <kremenek@apple.com> Revert 59574 (caused tests to fail).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
0a3626444039396802fa35db24733c1963aebfac 19-Nov-2008 Ted Kremenek <kremenek@apple.com> - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
(simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59574 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
56b05c8829efd13b7e5b333f8f587c71d025c67d 18-Nov-2008 Chris Lattner <sabre@nondot.org> remove one more Preprocessor::Diag method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
f6452c5421c5db5a7ceff581525f286931d97f1a 18-Nov-2008 Ted Kremenek <kremenek@apple.com> Add hooks to use PTHLexer::Lex instead of Lexer::Lex when CurLexer is null.
Performance tests on Cocoa.h (using the regular Lexer) shows no performance
difference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
ac6b06df32e907cac388a92310650b5895c11241 18-Nov-2008 Ted Kremenek <kremenek@apple.com> Added conditional guard 'if (CurLexer)' when using SetCommentRetentionState().
This is because the PTHLexer will not support this method. Performance testing
on preprocessing Cocoa.h shows that this results in a negligible performance
difference (less than 1%).

I tried making Lexer::SetCommentRetentionState() an out-of-line function (a
precursor to making it a virtual function in PreprocessorLexer) and noticed a 1%
decrease in speed (it is called in a hot part of the Preprocessor).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
60e45d4c41479fb58ad14d97efd03418e8549509 18-Nov-2008 Ted Kremenek <kremenek@apple.com> Change a bunch of uses of 'CurLexer->' to 'CurPPLexer->', which should be the
alias for the current PreprocessorLexer. No functionality change. Performance
testing shows this results in no performance degradation when preprocessing
Cocoa.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
9d72851fec9e9c62570a027d42701562bbf29751 27-Oct-2008 Chris Lattner <sabre@nondot.org> Rename Characteristic_t to CharacteristicKind



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
aea3ad073793f7764aa914bd9e551f858a0b5739 12-Oct-2008 Chris Lattner <sabre@nondot.org> Stop the preprocessor from poking the lexer's private parts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.cpp
0b9e736308af5397f558ffc8e780c438c2fdb563 26-Sep-2008 Chris Lattner <sabre@nondot.org> clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
acc5f3e42334525bf28c86471551f83dfce222d5 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
sweep so some things removed are actually used, but happen to be
included by a previous header. I tried to get rid of the obvious
examples and this was the easiest way to trim the #includes in one
fell swoop.
- We now return to regularly scheduled development.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Lex/PPDirectives.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/PPDirectives.cpp
0049db6ce127cbf4671a6a81ad4dfe61fdc4aa5c 01-Jun-2008 Nuno Lopes <nunoplopes@sapo.pt> fix PR2357 (#ifs didnt invalidate the multiple-inclusion optimization state)

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