summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Pragma.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-65/+65
| | | | llvm-svn: 81346
* add push/pop semantics for diagnostics. Patch by Louis Gerbarg!Chris Lattner2009-07-121-8/+36
| | | | llvm-svn: 75431
* Add support for retrieving the Doxygen comment associated with a givenDouglas Gregor2009-07-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declaration in the AST. The new ASTContext::getCommentForDecl function searches for a comment that is attached to the given declaration, and returns that comment, which may be composed of several comment blocks. Comments are always available in an AST. However, to avoid harming performance, we don't actually parse the comments. Rather, we keep the source ranges of all of the comments within a large, sorted vector, then lazily extract comments via a binary search in that vector only when needed (which never occurs in a "normal" compile). Comments are written to a precompiled header/AST file as a blob of source ranges. That blob is only lazily loaded when one requests a comment for a declaration (this never occurs in a "normal" compile). The indexer testbed now supports comment extraction. When the -point-at location points to a declaration with a Doxygen-style comment, the indexer testbed prints the associated comment block(s). See test/Index/comments.c for an example. Some notes: - We don't actually attempt to parse the comment blocks themselves, beyond identifying them as Doxygen comment blocks to associate them with a declaration. - We won't find comment blocks that aren't adjacent to the declaration, because we start our search based on the location of the declaration. - We don't go through the necessary hops to find, for example, whether some redeclaration of a declaration has comments when our current declaration does not. Similarly, we don't attempt to associate a \param Foo marker in a function body comment with the parameter named Foo (although that is certainly possible). - Verification of my "no performance impact" claims is still "to be done". llvm-svn: 74704
* Fix a crash that can occur when a #pragma handler eats to the end of theChris Lattner2009-06-181-1/+1
| | | | | | | | line, and when the pragma is at the end of a file. In this case, the last token consumed could pop the lexer, invalidating CurPPLexer. Thanks to Peter Thoman for pointing it out. llvm-svn: 73689
* Fix #pragma GCC system_header by making it insert a virtual linemarker intoChris Lattner2009-06-151-2/+16
| | | | | | | the file at the point of the pragma. This allows clang to know that all sourcelocations after the pragma are in a system header. llvm-svn: 73376
* accept "#pragma clang foo" where we accept "#pragma GCC foo".Chris Lattner2009-05-121-1/+12
| | | | llvm-svn: 71572
* implement "#pragma GCC diagnostic". Besides being a nice feature, thisChris Lattner2009-04-191-2/+79
| | | | | | | | | will let us test for multiple different warning modes in the same file in regression tests. This implements rdar://2362963, a 10-year old feature request :) llvm-svn: 69560
* Warn about uses of #pragma STDC FENV_ACCESS ON, since we don't Chris Lattner2009-04-191-1/+2
| | | | | | | | | | support it. I don't know what evaluation method we use for complex arithmetic, so I don't know whether/if we should warn about use of CX_LIMITED_RANGE. This concludes my planned hacking on STDC pragmas, flame away :) llvm-svn: 69556
* diagnose invalid syntax of STDC pragmas.Chris Lattner2009-04-191-3/+40
| | | | llvm-svn: 69554
* reject invalid stuff in the STDC namespace.Chris Lattner2009-04-191-8/+8
| | | | llvm-svn: 69551
* stub out STDC #pragmas.Chris Lattner2009-04-191-0/+44
| | | | llvm-svn: 69550
* basic support for -Wunknown-pragmas, more coming.Chris Lattner2009-04-191-1/+4
| | | | llvm-svn: 69547
* Fix the #import / #include_next "extra tokens at end of #foo directive" Chris Lattner2009-04-141-2/+2
| | | | | | | Warning to properly report that it is an import/include_next instead of claiming it is a #include. llvm-svn: 69023
* typoGabor Greif2009-03-171-1/+1
| | | | llvm-svn: 67081
* simplify some logic by making ScratchBuffer handle the application of trailingChris Lattner2009-03-081-4/+2
| | | | | | | \0's to created tokens instead of making all clients do it. No functionality change. llvm-svn: 66373
* track "just a little more" location information for macro instantiations.Chris Lattner2009-02-151-2/+3
| | | | | | | | | | | | 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
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .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
* This change refactors some of the low-level lexer interfaces a bit.Chris Lattner2009-01-261-1/+4
| | | | | | | | | | | | | 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
* Make SourceLocation::getFileLoc private to reduce the API exposure of Chris Lattner2009-01-191-2/+2
| | | | | | | SourceLocation. This requires making some cleanups to token pasting and _Pragma expansion. llvm-svn: 62490
* Change the Lexer ctor used to lex _Pragma directives into a static factoryChris Lattner2009-01-171-10/+3
| | | | | | | | | | | 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
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-7/+3
| | | | | | | | | | | | | | | "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
* only notify callbacks if they exist.Chris Lattner2009-01-161-1/+2
| | | | llvm-svn: 62334
* Improve #pragma comment support by building the string argument andChris Lattner2009-01-161-11/+36
| | | | | | notifying PPCallbacks about it. llvm-svn: 62333
* Implement basic support for parsing #pragma comment, a microsoft extensionChris Lattner2009-01-161-0/+80
| | | | | | | | | | 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
* Just use the SourceLocation of SysHeaderTok when doing a callback to emit #lineTed Kremenek2008-11-201-2/+2
| | | | | | | information. A diff of the -E output for Cocoa.h shows that there is no change in output. llvm-svn: 59693
* Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is ↵Ted Kremenek2008-11-191-5/+5
| | | | | | an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*. llvm-svn: 59672
* When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().Ted Kremenek2008-11-191-2/+3
| | | | llvm-svn: 59668
* remove one more Preprocessor::Diag method.Chris Lattner2008-11-181-4/+6
| | | | llvm-svn: 59512
* Convert the lexer and start converting the PP over to using canonical Diag ↵Chris Lattner2008-11-181-6/+12
| | | | | | methods. llvm-svn: 59511
* Replace more uses of 'CurLexer->' with 'CurPPLexer->'. No performance change.Ted Kremenek2008-11-181-4/+4
| | | | llvm-svn: 59482
* Add Preprocessor::RemovePragmaHandler.Daniel Dunbar2008-10-041-0/+37
| | | | | | - No functionality change. llvm-svn: 57065
* clean up a bunch of fixme's I added, by moving Chris Lattner2008-09-261-2/+1
| | | | | | DirectoryLookup::DirType into SourceManager.h llvm-svn: 56692
* More #include cleaningDaniel Dunbar2008-08-111-2/+0
| | | | | | | | | | | - 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
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+386
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
OpenPOWER on IntegriCloud