David Blaikie
bbafb8a745
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
llvm-svn: 152536
2012-03-11 07:00:24 +00:00
Benjamin Kramer
7ec12c928a
Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.
...
This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.
This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.
llvm-svn: 150006
2012-02-07 22:29:24 +00:00
Dylan Noblesmith
2c1dd2716a
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.)
llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Benjamin Kramer
02c746de10
Remove Diagnostic.h include from Preprocessor.h.
...
- Move the offending methods out of line and fix transitive includers.
- This required changing an enum in the PPCallback API into an unsigned.
llvm-svn: 149782
2012-02-04 13:02:15 +00:00
David Blaikie
f47fa304a4
Remove unnecessary default cases in switches over enums.
...
This allows -Wswitch-enum to find switches that need updating when these enums are modified.
llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Dylan Noblesmith
1ced737ebf
remove unneeded config.h includes
...
llvm-svn: 147195
2011-12-22 22:49:47 +00:00
Argyrios Kyrtzidis
7a70d2f11b
For the FileChanged Preprocessor callback, when exiting a file, pass its FileID.
...
llvm-svn: 141681
2011-10-11 17:29:44 +00:00
Francois Pichet
0706d203cf
Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.
...
Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.
llvm-svn: 139987
2011-09-17 17:15:52 +00:00
Chandler Carruth
42f35f9cd2
Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
...
SourceManager and FullSourceLoc.
llvm-svn: 135965
2011-07-25 20:57:57 +00:00
Chris Lattner
0e62c1cc0b
remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
...
them into the clang namespace.
llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chandler Carruth
46a32c2f0a
Update the remaining comments in Frontend to 'expansion'.
...
llvm-svn: 135150
2011-07-14 16:14:52 +00:00
Douglas Gregor
3bde9b15a1
Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!
...
llvm-svn: 133633
2011-06-22 19:41:48 +00:00
Peter Collingbourne
2f1e36bfd0
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.
llvm-svn: 126631
2011-02-28 02:37:51 +00:00
Daniel Dunbar
27734fdbbf
Frontend: Factor out header include dumping (-H) into its own preprocessor
...
callbacks class.
- Aside from being generally cleaner, this also allows -H to work correctly in
modes other than standard preprocessing (e.g., -c, -MM, etc.)
llvm-svn: 124723
2011-02-02 15:41:17 +00:00
Craig Silverstein
1a9ca21881
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
llvm-svn: 119845
2010-11-19 21:33:15 +00:00
Douglas Gregor
453b012513
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.
llvm-svn: 118885
2010-11-12 07:15:47 +00:00
Chris Lattner
49609d56d7
make sure #pragma clang is treated the same way as #pragma gcc in -E mode,
...
unknown pragmas should just be passed through to the .i file.
llvm-svn: 118659
2010-11-10 01:00:49 +00:00
Ted Kremenek
6174ca456f
Handle '#line' in '-E' that has an empty file name. Fixes <rdar://problem/8439412>.
...
llvm-svn: 114142
2010-09-17 00:41:18 +00:00
Douglas Gregor
ca3682d486
Make sure we're producing a newline in the preprocessed output before
...
emitting a #pragma, whenever one is needed. Fixes <rdar://problem/8417307>.
llvm-svn: 113648
2010-09-10 22:27:29 +00:00
Douglas Gregor
c7d6576d54
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>.
llvm-svn: 113553
2010-09-09 22:45:38 +00:00
Daniel Dunbar
04ebde017f
Frontend/-H: Add comment on why I used a temporary string here.
...
llvm-svn: 113379
2010-09-08 18:19:55 +00:00
Daniel Dunbar
d435275c59
Frontend: Add basic -H support.
...
- I didn't implement the GCC "multiple include guard" detection parts, because
it doesn't seem useful or obvious.
llvm-svn: 111983
2010-08-24 22:44:13 +00:00
Benjamin Kramer
d05f31d059
Push location through the MacroUndefined PPCallback and use it to print #undefs in -dD mode. (PR7818)
...
llvm-svn: 110523
2010-08-07 22:27:00 +00:00
Argyrios Kyrtzidis
36745fda34
Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
...
When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.
As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.
llvm-svn: 108237
2010-07-13 09:07:17 +00:00
Chris Lattner
30c924b3e8
Implement support for #pragma message, patch by Michael Spencer!
...
llvm-svn: 106950
2010-06-26 17:11:39 +00:00
Chris Lattner
bba37f4dea
fix the various buildbot failures by ensuring that tokens are really completely initialized.
...
llvm-svn: 106043
2010-06-15 21:06:38 +00:00
Chris Lattner
4e18a2bc97
fix an uninitialized variable, patch by Michael Spencer!
...
llvm-svn: 106025
2010-06-15 18:55:23 +00:00
Chris Lattner
bc6bcabc61
fix PR7360: -P mode turns off line markers, but not blank space.
...
Apparently some programs which abuse the preprocessor depend
on this.
llvm-svn: 105889
2010-06-12 16:20:56 +00:00
Daniel Dunbar
d839e77b12
Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
...
llvm-svn: 105830
2010-06-11 20:10:12 +00:00
Chris Lattner
fb24a3a4ec
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.
llvm-svn: 101939
2010-04-20 20:35:58 +00:00
Dan Gohman
6e8427e066
Remove this hard-coded buffer size. In some basic experiments preprocessing
...
large files, this doesn't seem significantly better than just letting
raw_ostream pick a buffer size.
This code predates raw-ostream's automatic buffer sizing; in fact, it
was introduced as part of the code which would eventually become
raw_ostream.
llvm-svn: 101473
2010-04-16 16:28:05 +00:00
Chris Lattner
c745cec17c
Improve line marker directive locations, patch by Jordy Rose
...
llvm-svn: 101226
2010-04-14 04:28:50 +00:00
Chris Lattner
0384e63501
make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."
...
when avoiding paste. Patch by David Peixotto!
llvm-svn: 101218
2010-04-14 03:57:19 +00:00
Chris Lattner
9d94f04f27
cache the PP's SourceManager.
...
llvm-svn: 101099
2010-04-13 00:06:42 +00:00
Chris Lattner
5dbefc6697
make the preprocessor listen to linemarker directives in -E mode,
...
PR6101. This is based on a patch and testcase by Jordy Rose!
llvm-svn: 101097
2010-04-13 00:01:41 +00:00
Douglas Gregor
4ad3da2843
Entering the main source file in the preprocessor can fail if the
...
source file has been changed. Handle that failure more gracefully.
llvm-svn: 98727
2010-03-17 15:44:30 +00:00
Kovarththanan Rajaratnam
ba2c65277a
Use SmallString instead of SmallVector
...
llvm-svn: 98436
2010-03-13 10:17:05 +00:00
Kovarththanan Rajaratnam
752a124aeb
Rename to addPPCallbacks since we're effectively adding a callback and maybe chaining it to an existing one
...
llvm-svn: 97913
2010-03-07 07:30:06 +00:00
Benjamin Kramer
718f722271
Revert 97324. Chris says this cleanup could hurt -E performance.
...
llvm-svn: 97331
2010-02-27 18:02:51 +00:00
Benjamin Kramer
b14e0b637a
Simplify code.
...
llvm-svn: 97324
2010-02-27 14:22:08 +00:00
Benjamin Kramer
0a1abd4088
Add an overload of Preprocessor::getSpelling which takes a SmallVector and
...
returns a StringRef. Use it to simplify some repetitive code.
llvm-svn: 97322
2010-02-27 13:44:12 +00:00
Benjamin Kramer
fb5f40f959
Avoid an instantiation of std::sort.
...
llvm-svn: 93882
2010-01-19 17:42:20 +00:00
Chris Lattner
53d80e2c07
Neil points out that this could be simplified, do it.
...
llvm-svn: 90927
2009-12-09 02:08:14 +00:00
Chris Lattner
9dfed9fdb6
fix -dM with variadic macros, PR5699
...
llvm-svn: 90735
2009-12-07 01:58:34 +00:00
Chris Lattner
76b4445d6f
some code cleanup.
...
llvm-svn: 90732
2009-12-07 01:42:56 +00:00
Steve Naroff
66aaa39568
Integrate the following from the 'objective-rewrite' branch:
...
http://llvm.org/viewvc/llvm-project?view=rev&revision=71473
llvm-svn: 90688
2009-12-06 01:02:14 +00:00
Daniel Dunbar
22bdabf05f
Add PreprocessorOutputOptions to CompilerInvocation, and move initialization to
...
clang-cc/Options.cpp
llvm-svn: 86828
2009-11-11 10:07:44 +00:00
Daniel Dunbar
531f6c662b
Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E
...
mode.
llvm-svn: 86827
2009-11-11 10:07:22 +00:00
Ted Kremenek
66791d5dc5
Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the target buffer needs to be resized. Fixes <rdar://problem/7255377>.
...
llvm-svn: 85872
2009-11-03 06:18:05 +00:00
Daniel Dunbar
07d0785dbb
PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
...
are updated.
llvm-svn: 84447
2009-10-18 21:17:35 +00:00