summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* add push/pop semantics for diagnostics. Patch by Louis Gerbarg!Chris Lattner2009-07-121-8/+36
| | | | llvm-svn: 75431
* Convert the CharInfo table to be statically initialized, instead of ↵Chris Lattner2009-07-071-15/+86
| | | | | | dynamically initialized. Patch by Ryan Flynn! llvm-svn: 74919
* fix an out-of-date comment.Chris Lattner2009-07-071-5/+3
| | | | llvm-svn: 74894
* Add support for retrieving the Doxygen comment associated with a givenDouglas Gregor2009-07-023-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 our check for "random whitespace between a \ and newline" to workChris Lattner2009-06-231-2/+3
| | | | | | | | | | | | | | | with dos style newlines. I have a trivial test for this: // RUN: clang-cc %s -verify #define test(x, y) \ x ## y but I don't know how to get svn to not change newlines and testrunner doesn't work with dos style newlines either, so "not worth it". :) rdar://6994000 llvm-svn: 73945
* 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
* my refactoring of builtins changed target-specific builtins to only beChris Lattner2009-06-161-1/+1
| | | | | | | | | registered when PCH wasn't being used. We should always install (in BuiltinInfo) information about target-specific builtins, but we shouldn't register any builtin identifier infos. This fixes the build of apps that use PCH and target specific builtins together. llvm-svn: 73492
* PR4395: Don't detect token concatenation in C mode for Eli Friedman2009-06-151-3/+5
| | | | | | C++-specific tokens. llvm-svn: 73408
* 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
* use the new Path::isAbsolute function, fixing a fixme. Patch by Gregory ↵Chris Lattner2009-06-151-3/+1
| | | | | | Curfman! llvm-svn: 73370
* implement and document a new __has_feature and __has_builtin magic Chris Lattner2009-06-131-13/+82
| | | | | | | | | builtin preprocessor macro. This appears to work with two caveats: 1) builtins are registered in -E mode, and 2) target-specific builtins are unconditionally registered even if they aren't supported by the target (e.g. SSE4 builtin when only SSE1 is enabled). llvm-svn: 73289
* PR4353: Add support for \E as a character escape.Eli Friedman2009-06-101-1/+4
| | | | llvm-svn: 73153
* Move CharIsSigned from TargetInfo to LangOptions.Eli Friedman2009-06-052-2/+2
| | | | llvm-svn: 72928
* PR4283: Don't truncate multibyte character constants in the Eli Friedman2009-06-012-2/+7
| | | | | | preprocessor. llvm-svn: 72686
* fix the "pasting formed 'a]', an invalid preprocessing token"Chris Lattner2009-05-281-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic to include the full instantiation location for the invalid paste. For: #define foo(a, b) a ## b #define bar(x) foo(x, ]) bar(a) bar(zdy) Instead of: t.c:3:22: error: pasting formed 'a]', an invalid preprocessing token #define foo(a, b) a ## b ^ t.c:3:22: error: pasting formed 'zdy]', an invalid preprocessing token we now produce: t.c:7:1: error: pasting formed 'a]', an invalid preprocessing token bar(a) ^ t.c:4:16: note: instantiated from: #define bar(x) foo(x, ]) ^ t.c:3:22: note: instantiated from: #define foo(a, b) a ## b ^ t.c:8:1: error: pasting formed 'zdy]', an invalid preprocessing token bar(zdy) ^ t.c:4:16: note: instantiated from: #define bar(x) foo(x, ]) ^ t.c:3:22: note: instantiated from: #define foo(a, b) a ## b ^ llvm-svn: 72519
* Don't vary token concatenation based on the language options; this Eli Friedman2009-05-271-6/+3
| | | | | | behavior is more likely to be confusing than useful. llvm-svn: 72499
* Make the bad paste diagnostic print the entire pasted token.Eli Friedman2009-05-271-1/+1
| | | | llvm-svn: 72497
* Fix a couple of bugs:Chris Lattner2009-05-251-18/+27
| | | | | | | | | | | | 1. When we accept "#garbage" in asm-with-cpp mode, change the token kind of the # to unknown so that the preprocessor won't try to process it as a real #. This fixes a crash on the attached example 2. Fix macro definition extents processing to handle #foo at the end of a macro to say the definition ends with the foo, not the #. This is a follow-on fix to r72283, and rdar://6916026 llvm-svn: 72388
* improve comment, no functionality change.Chris Lattner2009-05-251-10/+15
| | | | llvm-svn: 72386
* Make sure an invalid concatentaion doesn't insert whitespace before Eli Friedman2009-05-241-1/+5
| | | | | | the RHS. Fixes assembler-with-cpp issue reported on cfe-dev. llvm-svn: 72370
* In assembler-with-cpp mode, don't error on '#' (stringize) operator applied toDaniel Dunbar2009-05-221-3/+5
| | | | | | non-argument names, pass the tokens through. llvm-svn: 72283
* The TokenLexer may encounter annotations if the parser enters them using ↵Argyrios Kyrtzidis2009-05-221-1/+2
| | | | | | | | Preprocessor::EnterTokenStream. So check for annotation before using the Token's IdentifierInfo. llvm-svn: 72278
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-212-3/+4
| | | | llvm-svn: 72210
* PR3942: Don't warn on unsigned overflow in preprocessor expressions.Eli Friedman2009-05-161-4/+4
| | | | llvm-svn: 71960
* Fix rdar://6880630 - # in _Pragma does not start a preprocessor directive.Chris Lattner2009-05-131-2/+2
| | | | llvm-svn: 71643
* When we expect two arguments but have zero, make sure to addChris Lattner2009-05-132-0/+6
| | | | | | | | | two empty arguments. Also, add an assert so that this bug manifests as an assertion failure, not a valgrind problem. This fixes rdar://6880648 - [cpp] crash in ArgNeedsPreexpansion llvm-svn: 71616
* accept "#pragma clang foo" where we accept "#pragma GCC foo".Chris Lattner2009-05-121-1/+12
| | | | llvm-svn: 71572
* Fix for PR4132: make sure to insert whitespace consistently before a Eli Friedman2009-05-031-1/+1
| | | | | | pasted token. llvm-svn: 70793
* Implement -Wfour-char-constants, which is an extension, not an extwarn,Chris Lattner2009-04-281-23/+23
| | | | | | and apparently not part of -Wall llvm-svn: 70329
* implement -WmulticharChris Lattner2009-04-281-1/+2
| | | | llvm-svn: 70315
* Emit keyword extension warning in all modes, not just C99 mode.Eli Friedman2009-04-281-1/+3
| | | | llvm-svn: 70283
* Get rid of some useless uses of NoExtensions. The philosophy here is Eli Friedman2009-04-282-7/+4
| | | | | | | | | | | | that if we're going to print an extension warning anyway, there's no point to changing behavior based on NoExtensions: it will only make error recovery worse. Note that this doesn't cause any behavior change because NoExtensions isn't used by the current front-end. I'm still considering what to do about the remaining use of NoExtensions in IdentifierTable.cpp. llvm-svn: 70273
* Lazily load the controlling macros for all of the headers known in theDouglas Gregor2009-04-251-6/+20
| | | | | | | | PCH file. In the Cocoa-prefixed "Hello, World" benchmark, this takes us from reading 503 identifiers down to 37 and from 470 macros down to 4. It also results in an 8% performance improvement. llvm-svn: 70094
* Silence gcc warnings.Eli Friedman2009-04-251-2/+2
| | | | llvm-svn: 70086
* Add PCH support for #import.Steve Naroff2009-04-242-4/+10
| | | | llvm-svn: 69987
* fix rdar://6816766 - Crash with function-like macro test at end of directive.Chris Lattner2009-04-241-0/+2
| | | | llvm-svn: 69964
* simplification and speedupChris Lattner2009-04-241-1/+1
| | | | llvm-svn: 69963
* apply Eli's patch to fix PR4008, with a testcase. Thanks Eli!Chris Lattner2009-04-211-0/+8
| | | | llvm-svn: 69750
* improve MacroInfo to track the source range of the macro definition,Chris Lattner2009-04-211-1/+10
| | | | | | patch by Alexei Svitkine! llvm-svn: 69659
* add a preprocessor callback function for #undef, patch byChris Lattner2009-04-211-1/+5
| | | | | | Alexei Svitkine! llvm-svn: 69656
* Use an APInt of target int size to detect overflow while parsing multichars.Sanjiv Gupta2009-04-211-13/+18
| | | | | | So 'abc' on i16 platforms will warn but not on i32 platforms. llvm-svn: 69653
* fix the second half of PR4006 and rdar://6807000 by treatingChris Lattner2009-04-201-7/+11
| | | | | | | () as being either zero arguments or one empty argument depending on situation. llvm-svn: 69627
* Move the on-disk hash table code into its own header. No functionality change.Douglas Gregor2009-04-201-171/+2
| | | | llvm-svn: 69580
* 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
* move token paste poisoning diagnostics to after the instantiation locChris Lattner2009-04-191-11/+16
| | | | | | | for a token is set, this makes the diagnostic "expanded from stack" work for this diagnostic. Add a testcase for PR3918. llvm-svn: 69544
OpenPOWER on IntegriCloud