aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PrintPreprocessedOutput.cpp
AgeCommit message (Collapse)Author
2012-02-07Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer
operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05Basic: import SmallString<> into clang namespaceDylan Noblesmith
(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
2012-02-04Remove Diagnostic.h include from Preprocessor.h.Benjamin Kramer
- Move the offending methods out of line and fix transitive includers. - This required changing an enum in the PPCallback API into an unsigned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149782 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17Remove unnecessary default cases in switches over enums.David Blaikie
This allows -Wswitch-enum to find switches that need updating when these enums are modified. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22remove unneeded config.h includesDylan Noblesmith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11For the FileChanged Preprocessor callback, when exiting a file, pass its FileID.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141681 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-17Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139987 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25Rename getInstantiationColumnNumber to getExpansionColumnNumber in bothChandler Carruth
SourceManager and FullSourceLoc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
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
2011-07-14Update the remaining comments in Frontend to 'expansion'.Chandler Carruth
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135150 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133633 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28Rename tok::eom to tok::eod.Peter Collingbourne
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
2011-02-02Frontend: Factor out header include dumping (-H) into its own preprocessorDaniel Dunbar
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.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124723 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19Several PPCallbacks take an SourceLocation + IdentifierInfo, ratherCraig Silverstein
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
2010-11-12Make sure to always check the result ofDouglas Gregor
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
2010-11-10make sure #pragma clang is treated the same way as #pragma gcc in -E mode,Chris Lattner
unknown pragmas should just be passed through to the .i file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118659 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17Handle '#line' in '-E' that has an empty file name. Fixes ↵Ted Kremenek
<rdar://problem/8439412>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10Make sure we're producing a newline in the preprocessed output beforeDouglas Gregor
emitting a #pragma, whenever one is needed. Fixes <rdar://problem/8417307>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113648 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09When we parse a pragma, keep track of how that pragma was originallyDouglas Gregor
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
2010-09-08Frontend/-H: Add comment on why I used a temporary string here.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24Frontend: Add basic -H support.Daniel Dunbar
- I didn't implement the GCC "multiple include guard" detection parts, because it doesn't seem useful or obvious. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111983 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07Push location through the MacroUndefined PPCallback and use it to print ↵Benjamin Kramer
#undefs in -dD mode. (PR7818) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110523 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13Modify the pragma handlers to accept and use StringRefs instead of ↵Argyrios Kyrtzidis
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-06-26Implement support for #pragma message, patch by Michael Spencer!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15fix the various buildbot failures by ensuring that tokens are really ↵Chris Lattner
completely initialized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106043 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15fix an uninitialized variable, patch by Michael Spencer!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-12fix PR7360: -P mode turns off line markers, but not blank space.Chris Lattner
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-11Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20push some source location information down through the compiler,Chris Lattner
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-16Remove this hard-coded buffer size. In some basic experiments preprocessingDan Gohman
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-14Improve line marker directive locations, patch by Jordy RoseChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101226 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."Chris Lattner
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-13cache the PP's SourceManager.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13make the preprocessor listen to linemarker directives in -E mode,Chris Lattner
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-03-17Entering the main source file in the preprocessor can fail if theDouglas Gregor
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-13Use SmallString instead of SmallVectorKovarththanan Rajaratnam
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-07Rename to addPPCallbacks since we're effectively adding a callback and maybe ↵Kovarththanan Rajaratnam
chaining it to an existing one git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27Revert 97324. Chris says this cleanup could hurt -E performance.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97331 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27Simplify code.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97324 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27Add an overload of Preprocessor::getSpelling which takes a SmallVector andBenjamin Kramer
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-01-19Avoid an instantiation of std::sort.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09Neil points out that this could be simplified, do it.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07fix -dM with variadic macros, PR5699Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07some code cleanup.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06Integrate the following from the 'objective-rewrite' branch:Steve Naroff
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-11-11Add PreprocessorOutputOptions to CompilerInvocation, and move initialization toDaniel Dunbar
clang-cc/Options.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -EDaniel Dunbar
mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03Fix buffer overflow in PrintMacroDefinition() by inverting the check to see ↵Ted Kremenek
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-10-18PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar
are updated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18Move misc clients to IdentifierInfo StringRef API.Daniel Dunbar
- 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