summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Pragma.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement -MG. Fixes PR9613Peter Collingbourne2011-07-121-1/+1
| | | | llvm-svn: 134996
* Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!Douglas Gregor2011-06-221-4/+13
| | | | llvm-svn: 133633
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-7/+4
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Disable MSVC warning about runtime stack overflow for DebugOverflowStack.Francois Pichet2011-05-251-0/+8
| | | | llvm-svn: 132059
* A StringRef-ication of the DiagnosticIDs API and internals.Argyrios Kyrtzidis2011-05-251-3/+2
| | | | | | | | | Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static diagnostic data structures, which resulted in a huge global-var-init function. Depends on llvm commit r132046. llvm-svn: 132047
* Invoke the FileChanged callback before pushing the linemarker for a systemChris Lattner2011-05-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | header. Getting it in the wrong order generated incorrect line markers in -E mode. In the testcase from PR9861 we used to generate: # 1 "test.c" 2 # 1 "./foobar.h" 1 # 0 "./foobar.h" # 0 "./foobar.h" 3 # 2 "test.c" 2 now we properly produce: # 1 "test.c" 2 # 1 "./foobar.h" 1 # 1 "./foobar.h" 3 # 2 "test.c" 2 This fixes PR9861. llvm-svn: 131871
* To be able to replay compilations we need to accurately remodel howManuel Klimek2011-04-261-1/+1
| | | | | | | | | includes get resolved, especially when they are found relatively to another include file. We also try to get it working for framework includes, but that part of the code is untested, as I don't have a code base that uses it. llvm-svn: 130246
* Add a 'RawPath' parameter to the PPCallbacks interface. This allowsChandler Carruth2011-03-161-1/+1
| | | | | | | | | | | | | | | clients to observe the exact path through which an #included file was located. This is very useful when trying to record and replay inclusion operations without it beind influenced by the aggressive caching done inside the FileManager to avoid redundant system calls and filesystem operations. The work to compute and return this is only done in the presence of callbacks, so it should have no effect on normal compilation. Patch by Manuel Klimek. llvm-svn: 127742
* Rename tok::eom to tok::eod.Peter Collingbourne2011-02-281-12/+12
| | | | | | | | 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
* Reimplement __pragma support using a TokenLexerPeter Collingbourne2011-02-221-36/+29
| | | | llvm-svn: 126221
* Make TokenLexer capable of storing preprocessor directive tokensPeter Collingbourne2011-02-221-1/+2
| | | | llvm-svn: 126220
* Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actionsPeter Collingbourne2011-02-141-15/+0
| | | | llvm-svn: 125474
* Make LexOnOffSwitch a Preprocessor member functionPeter Collingbourne2011-02-141-35/+35
| | | | llvm-svn: 125473
* Introduced raw_identifier token kind.Abramo Bagnara2010-12-221-2/+2
| | | | llvm-svn: 122394
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-4/+9
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Make sure to always check the result ofDouglas Gregor2010-11-121-0/+3
| | | | | | | SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. llvm-svn: 118885
* Fix typo in comment.Ted Kremenek2010-10-191-1/+1
| | | | llvm-svn: 116825
* Fix coding standard mistake from my last commit.Michael J. Spencer2010-09-271-1/+1
| | | | | | That, and keep aKor happy :P. llvm-svn: 114816
* Lexer: Implement GCC's version of pragma message.Michael J. Spencer2010-09-271-15/+26
| | | | llvm-svn: 114814
* When we parse a pragma, keep track of how that pragma was originallyDouglas Gregor2010-09-091-24/+44
| | | | | | | | 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
* 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
OpenPOWER on IntegriCloud