Commit Graph

27 Commits

Author SHA1 Message Date
Chris Lattner 02ef4e3dba diagnose invalid syntax of STDC pragmas.
llvm-svn: 69554
2009-04-19 21:50:08 +00:00
Chris Lattner a0b1f76d10 reject invalid stuff in the STDC namespace.
llvm-svn: 69551
2009-04-19 21:25:37 +00:00
Chris Lattner 958ee04368 stub out STDC #pragmas.
llvm-svn: 69550
2009-04-19 21:20:35 +00:00
Chris Lattner 21656f22db basic support for -Wunknown-pragmas, more coming.
llvm-svn: 69547
2009-04-19 21:10:26 +00:00
Chris Lattner ce2ab6f425 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.

llvm-svn: 69023
2009-04-14 05:07:49 +00:00
Gabor Greif 31a082fd7a typo
llvm-svn: 67081
2009-03-17 11:39:38 +00:00
Chris Lattner fa217bda40 simplify some logic by making ScratchBuffer handle the application of trailing
\0's to created tokens instead of making all clients do it.  No functionality
change.

llvm-svn: 66373
2009-03-08 08:08:45 +00:00
Chris Lattner 9dc9c206d3 track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full
range of the macro that got replaced.  For object-like macros, this doesn't
change anything.  For _Pragma and function-like macros, this means we track
the locations of the ')'.

This is required for PR3579 because apparently GCC uses the line of the ')'
of a function-like macro as the location to expand __LINE__ to.

llvm-svn: 64601
2009-02-15 20:52:18 +00:00
Chris Lattner 60f36223a9 move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes.  Patch by Anders Johnsen!

llvm-svn: 63271
2009-01-29 05:15:15 +00:00
Chris Lattner 7368d581c1 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!

llvm-svn: 63111
2009-01-27 18:30:58 +00:00
Chris Lattner 5a7971e0c3 This change refactors some of the low-level lexer interfaces a bit.
Token now has a class of kinds for "literals", which include 
numeric constants, strings, etc.  These tokens can optionally have
a pointer to the start of the token in the lexer buffer.  This 
makes it faster to get spelling and do other gymnastics, because we
don't have to go through source locations.

This change is performance neutral, but will make other changes
more feasible down the road.

llvm-svn: 63028
2009-01-26 19:29:26 +00:00
Chris Lattner 29a2a191f2 Make SourceLocation::getFileLoc private to reduce the API exposure of
SourceLocation.  This requires making some cleanups to token pasting
and _Pragma expansion.

llvm-svn: 62490
2009-01-19 06:46:35 +00:00
Chris Lattner 757169b60f Change the Lexer ctor used to lex _Pragma directives into a static factory
method.  This lets us clean up the interface and make it more obvious that
this method is *really really* _Pragma specific.

Note that _Pragma handling uglifies the Lexer in the critical path.  It would
be very interesting to consider making _Pragma remapping be a new special
lexer class of its own.

llvm-svn: 62425
2009-01-17 08:27:52 +00:00
Chris Lattner d32480d3db 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.

llvm-svn: 62407
2009-01-17 06:22:33 +00:00
Chris Lattner f49775dc81 only notify callbacks if they exist.
llvm-svn: 62334
2009-01-16 19:01:46 +00:00
Chris Lattner 262d4e31b9 Improve #pragma comment support by building the string argument and
notifying PPCallbacks about it.

llvm-svn: 62333
2009-01-16 18:59:23 +00:00
Chris Lattner 2ff698df60 Implement basic support for parsing #pragma comment, a microsoft extension
documented here:
http://msdn.microsoft.com/en-us/library/7f0aews7(VS.80).aspx

This is according to my understanding reading the docs, I don't know if it
really agrees fully with what VC++ allows.

llvm-svn: 62317
2009-01-16 08:21:25 +00:00
Ted Kremenek 300590b584 Just use the SourceLocation of SysHeaderTok when doing a callback to emit #line
information. A diff of the -E output for Cocoa.h shows that there is no change
in output.

llvm-svn: 59693
2008-11-20 01:45:11 +00:00
Ted Kremenek 2861cf42fe Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*.
llvm-svn: 59672
2008-11-19 22:55:25 +00:00
Ted Kremenek 76c3441a4e When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().
llvm-svn: 59668
2008-11-19 22:21:33 +00:00
Chris Lattner 97b8e84bd7 remove one more Preprocessor::Diag method.
llvm-svn: 59512
2008-11-18 08:02:48 +00:00
Chris Lattner 907dfe94e1 Convert the lexer and start converting the PP over to using canonical Diag methods.
llvm-svn: 59511
2008-11-18 07:59:24 +00:00
Ted Kremenek 551c82aa7b Replace more uses of 'CurLexer->' with 'CurPPLexer->'. No performance change.
llvm-svn: 59482
2008-11-18 01:12:54 +00:00
Daniel Dunbar 405965323d Add Preprocessor::RemovePragmaHandler.
- No functionality change.

llvm-svn: 57065
2008-10-04 19:17:46 +00:00
Chris Lattner b03dc76499 clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h

llvm-svn: 56692
2008-09-26 21:18:42 +00:00
Daniel Dunbar 56fdb6ae69 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.

llvm-svn: 54632
2008-08-11 06:23:49 +00:00
Chris Lattner 7a51313d8a 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.

llvm-svn: 48402
2008-03-15 23:59:48 +00:00