Commit Graph

85 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 9b36c3f0de Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 09:07:17 +00:00
Chris Lattner abfe094ce7 Implement support for #pragma message, patch by Michael Spencer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 17:11:39 +00:00
Chris Lattner c54539cd17 fix the various buildbot failures by ensuring that tokens are really completely initialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106043 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 21:06:38 +00:00
Chris Lattner 90db74c361 fix an uninitialized variable, patch by Michael Spencer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 18:55:23 +00:00
Chris Lattner 6133aeb97d fix PR7360: -P mode turns off line markers, but not blank space.
Apparently some programs which abuse the preprocessor depend 
on this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-12 16:20:56 +00:00
Daniel Dunbar c72cc5072c Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-11 20:10:12 +00:00
Chris Lattner e127a0d801 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
2010-04-20 20:35:58 +00:00
Dan Gohman 8ed4ff6d05 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 16:28:05 +00:00
Chris Lattner 86d0ef7430 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
2010-04-14 04:28:50 +00:00
Chris Lattner 8877321ca6 make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."
when avoiding paste.  Patch by David Peixotto!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101218 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 03:57:19 +00:00
Chris Lattner df721408f5 cache the PP's SourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 00:06:42 +00:00
Chris Lattner 88aae9188a make the preprocessor listen to linemarker directives in -E mode,
PR6101.  This is based on a patch and testcase by Jordy Rose!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 00:01:41 +00:00
Douglas Gregor dbf8ee630e Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98727 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 15:44:30 +00:00
Kovarththanan Rajaratnam 193575455e Use SmallString instead of SmallVector
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 10:17:05 +00:00
Kovarththanan Rajaratnam a5d10c4df4 Rename to addPPCallbacks since we're effectively adding a callback and maybe chaining it to an existing one
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-07 07:30:06 +00:00
Benjamin Kramer e396007efa Revert 97324. Chris says this cleanup could hurt -E performance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97331 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 18:02:51 +00:00
Benjamin Kramer 8caa6c56b1 Simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97324 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 14:22:08 +00:00
Benjamin Kramer ddeea56443 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
2010-02-27 13:44:12 +00:00
Benjamin Kramer 3ff2a4b861 Avoid an instantiation of std::sort.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93882 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 17:42:20 +00:00
Chris Lattner 13d555859c Neil points out that this could be simplified, do it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 02:08:14 +00:00
Chris Lattner 807b93ee6a fix -dM with variadic macros, PR5699
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 01:58:34 +00:00
Chris Lattner f744934600 some code cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 01:42:56 +00:00
Steve Naroff d76fbda5da Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71473



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 01:02:14 +00:00
Daniel Dunbar 29cf746aef Add PreprocessorOutputOptions to CompilerInvocation, and move initialization to
clang-cc/Options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:07:44 +00:00
Daniel Dunbar 775bee71ad Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E
mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:07:22 +00:00
Ted Kremenek 3e27c01eb4 Fix buffer overflow in PrintMacroDefinition() by inverting the check to see if the target buffer needs to be resized. Fixes <rdar://problem/7255377>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 06:18:05 +00:00
Daniel Dunbar 01eb9b9683 PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
are updated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 21:17:35 +00:00
Daniel Dunbar 5ffe14ca96 Move misc clients to IdentifierInfo StringRef API.
- strcmp -> ==
 - OS.write(II->getName() ...) -> OS << II->getNameStr()
 - Avoid std::string concatenation
 - Use getNameStr().str() when an std::string is really needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84437 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 20:26:27 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Chris Lattner ed2d7c4ffd no really, add the lines :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:08:28 +00:00
Chris Lattner 3ee211fd15 Fix PR2741 by making our newline tracking be aware of newlines that
can occur in the middle of comment tokens.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 01:25:23 +00:00
Eli Friedman 3e753e279d PR4288: Make -dD (dump macros with preprocessed source) play nicely with
# line directives.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 07:55:39 +00:00
Jay Foad beaaccd8e2 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
2009-05-21 09:52:38 +00:00
Eli Friedman ac8d6298a8 Clean up some unnecessary includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 04:30:57 +00:00
Eli Friedman b09f6e15c5 Move clang-cc.h to lib/Frontend/Utils.h, and move the associated .cpp
files to lib/Frontend.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 04:14:29 +00:00