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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								04ebde017f 
								
							 
						 
						
							
							
								
								Frontend/-H: Add comment on why I used a temporary string here.  
							
							... 
							
							
							
							llvm-svn: 113379 
							
						 
						
							2010-09-08 18:19:55 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								30c924b3e8 
								
							 
						 
						
							
							
								
								Implement support for #pragma message, patch by Michael Spencer!  
							
							... 
							
							
							
							llvm-svn: 106950 
							
						 
						
							2010-06-26 17:11:39 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								4e18a2bc97 
								
							 
						 
						
							
							
								
								fix an uninitialized variable, patch by Michael Spencer!  
							
							... 
							
							
							
							llvm-svn: 106025 
							
						 
						
							2010-06-15 18:55:23 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								d839e77b12 
								
							 
						 
						
							
							
								
								Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.  
							
							... 
							
							
							
							llvm-svn: 105830 
							
						 
						
							2010-06-11 20:10:12 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								c745cec17c 
								
							 
						 
						
							
							
								
								Improve line marker directive locations, patch by Jordy Rose  
							
							... 
							
							
							
							llvm-svn: 101226 
							
						 
						
							2010-04-14 04:28:50 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								9d94f04f27 
								
							 
						 
						
							
							
								
								cache the PP's SourceManager.  
							
							... 
							
							
							
							llvm-svn: 101099 
							
						 
						
							2010-04-13 00:06:42 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								ba2c65277a 
								
							 
						 
						
							
							
								
								Use SmallString instead of SmallVector  
							
							... 
							
							
							
							llvm-svn: 98436 
							
						 
						
							2010-03-13 10:17:05 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								718f722271 
								
							 
						 
						
							
							
								
								Revert 97324. Chris says this cleanup could hurt -E performance.  
							
							... 
							
							
							
							llvm-svn: 97331 
							
						 
						
							2010-02-27 18:02:51 +00:00  
				
					
						
							
							
								 
						
							
								b14e0b637a 
								
							 
						 
						
							
							
								
								Simplify code.  
							
							... 
							
							
							
							llvm-svn: 97324 
							
						 
						
							2010-02-27 14:22:08 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								fb5f40f959 
								
							 
						 
						
							
							
								
								Avoid an instantiation of std::sort.  
							
							... 
							
							
							
							llvm-svn: 93882 
							
						 
						
							2010-01-19 17:42:20 +00:00  
				
					
						
							
							
								 
						
							
								53d80e2c07 
								
							 
						 
						
							
							
								
								Neil points out that this could be simplified, do it.  
							
							... 
							
							
							
							llvm-svn: 90927 
							
						 
						
							2009-12-09 02:08:14 +00:00  
				
					
						
							
							
								 
						
							
								9dfed9fdb6 
								
							 
						 
						
							
							
								
								fix -dM with variadic macros, PR5699  
							
							... 
							
							
							
							llvm-svn: 90735 
							
						 
						
							2009-12-07 01:58:34 +00:00  
				
					
						
							
							
								 
						
							
								76b4445d6f 
								
							 
						 
						
							
							
								
								some code cleanup.  
							
							... 
							
							
							
							llvm-svn: 90732 
							
						 
						
							2009-12-07 01:42:56 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								22bdabf05f 
								
							 
						 
						
							
							
								
								Add PreprocessorOutputOptions to CompilerInvocation, and move initialization to  
							
							... 
							
							
							
							clang-cc/Options.cpp
llvm-svn: 86828 
							
						 
						
							2009-11-11 10:07:44 +00:00  
				
					
						
							
							
								 
						
							
								531f6c662b 
								
							 
						 
						
							
							
								
								Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E  
							
							... 
							
							
							
							mode.
llvm-svn: 86827 
							
						 
						
							2009-11-11 10:07:22 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								07d0785dbb 
								
							 
						 
						
							
							
								
								PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients  
							
							... 
							
							
							
							are updated.
llvm-svn: 84447 
							
						 
						
							2009-10-18 21:17:35 +00:00  
				
					
						
							
							
								 
						
							
								70e7eadd15 
								
							 
						 
						
							
							
								
								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.
llvm-svn: 84437 
							
						 
						
							2009-10-18 20:26:27 +00:00  
				
					
						
							
							
								 
						
							
								11289f4280 
								
							 
						 
						
							
							
								
								Remove tabs, and whitespace cleanups.  
							
							... 
							
							
							
							llvm-svn: 81346 
							
						 
						
							2009-09-09 15:08:12 +00:00  
				
					
						
							
							
								 
						
							
								a5e67757dc 
								
							 
						 
						
							
							
								
								no really, add the lines :)  
							
							... 
							
							
							
							llvm-svn: 73367 
							
						 
						
							2009-06-15 04:08:28 +00:00  
				
					
						
							
							
								 
						
							
								f2d49da9a8 
								
							 
						 
						
							
							
								
								Fix PR2741 by making our newline tracking be aware of newlines that  
							
							... 
							
							
							
							can occur in the middle of comment tokens.
llvm-svn: 73365 
							
						 
						
							2009-06-15 01:25:23 +00:00  
				
					
						
							
							
								 
						
							
								fd80b2af16 
								
							 
						 
						
							
							
								
								PR4288: Make -dD (dump macros with preprocessed source) play nicely with  
							
							... 
							
							
							
							# line directives.
llvm-svn: 72724 
							
						 
						
							2009-06-02 07:55:39 +00:00  
				
					
						
							
							
								 
						
							
								7d0479f2c2 
								
							 
						 
						
							
							
								
								Use v.data() instead of &v[0] when SmallVector v might be empty.  
							
							... 
							
							
							
							llvm-svn: 72210 
							
						 
						
							2009-05-21 09:52:38 +00:00  
				
					
						
							
							
								 
						
							
								cec35d7e6a 
								
							 
						 
						
							
							
								
								Clean up some unnecessary includes.  
							
							... 
							
							
							
							llvm-svn: 72101 
							
						 
						
							2009-05-19 04:30:57 +00:00  
				
					
						
							
							
								 
						
							
								16b7b6f511 
								
							 
						 
						
							
							
								
								Move clang-cc.h to lib/Frontend/Utils.h, and move the associated .cpp  
							
							... 
							
							
							
							files to lib/Frontend.
llvm-svn: 72099 
							
						 
						
							2009-05-19 04:14:29 +00:00