summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Pragma.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* fix 7320: we can't delete a trailing space if it doesn't exist.Chris Lattner2010-09-051-1/+3
| | | | llvm-svn: 113125
* Now that GCC will have #pragma push/pop (in GCC 4.6), allow theDouglas Gregor2010-08-301-31/+14
| | | | | | | #pragma without requiring it to be in the "clang" namespace, from Louis Gerbarg! llvm-svn: 112484
* Complain if a __pragma isn't terminated.John McCall2010-08-291-0/+5
| | | | llvm-svn: 112392
* Add support for Microsoft's __pragma in the preprocessor.John McCall2010-08-281-3/+51
| | | | | | Patch by Francois Pichet! llvm-svn: 112391
* CrashRecovery: Add #pragma clang __debug handle_crash, useful when debuggingDaniel Dunbar2010-08-181-0/+5
| | | | | | | CrashRecovery since it avoids sending a signal which may be intercepted by the debugger. llvm-svn: 111449
* Lex: Add #pragma clang __debug {llvm_fatal_error, llvm_unreachable}, for testingDaniel Dunbar2010-08-171-7/+13
| | | | | | those crash paths. llvm-svn: 111311
* Implement #pragma push_macro, patch by Francois Pichet!Chris Lattner2010-08-171-0/+125
| | | | llvm-svn: 111234
* Transcribe clattner email to SVN.Daniel Dunbar2010-07-291-1/+1
| | | | llvm-svn: 109727
* Change #pragma crash to segv, instead of abort.Daniel Dunbar2010-07-291-1/+1
| | | | llvm-svn: 109725
* Preprocessor: Add support for '#pragma clang __debug crash' and '#pragma clangDaniel Dunbar2010-07-281-0/+28
| | | | | | | | __debug overflow_stack'. - For testing crash reporting stuff... you'd think I could just use some C++ code but Doug keeps fixing stuff! llvm-svn: 109587
* Modify the pragma handlers to accept and use StringRefs instead of ↵Argyrios Kyrtzidis2010-07-131-74/+60
| | | | | | | | | | | 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
* Implement support for #pragma message, patch by Michael Spencer!Chris Lattner2010-06-261-1/+72
| | | | llvm-svn: 106950
* Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.Daniel Dunbar2010-06-111-0/+8
| | | | llvm-svn: 105830
* Audit all Preprocessor::getSpelling() callers, improving failureDouglas Gregor2010-03-161-1/+4
| | | | | | recovery for those that need it. llvm-svn: 98689
* Add an overload of Preprocessor::getSpelling which takes a SmallVector andBenjamin Kramer2010-02-271-4/+1
| | | | | | returns a StringRef. Use it to simplify some repetitive code. llvm-svn: 97322
* revert my patch for rdar://7520940 that warns when a published headerChris Lattner2010-01-221-2/+1
| | | | | | | is #included with "foo.h" style syntax instead of framework syntax. It produced too much noise. llvm-svn: 94120
* stringref'ize a bunch of filename handling logic. MuchChris Lattner2010-01-101-9/+7
| | | | | | nicer than passing around two const char*'s. llvm-svn: 93094
* implement rdar://7520940: published framework headers shouldChris Lattner2010-01-101-0/+1
| | | | | | | import other headers within the same framework with the full framework path, not with a relative include. llvm-svn: 93083
* 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
OpenPOWER on IntegriCloud