Commit Graph

135 Commits

Author SHA1 Message Date
Chris Lattner 794c001ad4 fix PR3764 - A redefinition of a pre-processor macro fails
Redefinition checking should ignore the leading whitespace and
start of line flags on the first token of an expansion.

llvm-svn: 66442
2009-03-09 20:33:32 +00:00
Chris Lattner 5c1f4d3c02 convert this to use -verify.
llvm-svn: 66441
2009-03-09 20:31:39 +00:00
Chris Lattner b960cdd255 rename test
llvm-svn: 66440
2009-03-09 20:30:53 +00:00
Chris Lattner d4a96730c1 #import is not considered an extension for ObjC.
llvm-svn: 66246
2009-03-06 04:28:03 +00:00
Chris Lattner 2edf0fcb75 fix PR3579: __LINE__ expands to the presumed location of the
*end* of a macro instantiation, not the start of it.  This is
really all about bug-for-bug compatibility with GCC, but not
doing this breaks the FreeBSD kernel.

llvm-svn: 64603
2009-02-15 21:06:15 +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
Mike Stump 6b63074de9 Fix limits.h for linux, as glibc does a #include_next unless
_GCC_LIMITS_H_ is defined, when __GNUC__ is defined.

Also, we need to stay away from possible conflicts with header guards.
We should use CLANG_ to prefix all header guards.

llvm-svn: 64408
2009-02-12 23:06:31 +00:00
Chris Lattner 1630c3c4f0 Add an implementation of -dM that follows GCC closely enough to permit
diffing the output of:
  clang -dM -o - -E -x c foo.c | sort

llvm-svn: 63926
2009-02-06 06:45:26 +00:00
Chris Lattner 2e731e369c smaller header.
llvm-svn: 63766
2009-02-04 19:47:38 +00:00
Chris Lattner 022923a22a Fix PR3464 by searching for headers from the predefines
buffer as if the #include happened from the main file.

llvm-svn: 63764
2009-02-04 19:45:07 +00:00
Chris Lattner 7ead0396f6 Ok, we need a system header for this test to pass in the clang/test directory as well as from the pp directory.
llvm-svn: 63763
2009-02-04 19:44:14 +00:00
Chris Lattner 988dff84f1 fix test
llvm-svn: 63762
2009-02-04 19:40:02 +00:00
Chris Lattner 2f7bb79c86 rename again
llvm-svn: 63761
2009-02-04 19:38:30 +00:00
Chris Lattner 4a82a24108 rename some tests
llvm-svn: 63759
2009-02-04 19:38:12 +00:00
Chris Lattner 3b04af73f1 include smaller header for test.
llvm-svn: 63758
2009-02-04 19:37:49 +00:00
Chris Lattner 1c967784f3 Implement handling of file entry/exit notifications from GNU
line markers, including maintenance of the virtual include stack.

For something like this:

# 42 "bar.c" 1
# 142 "bar2.c" 1

#warning zappa
# 92 "bar.c" 2
#warning gonzo
# 102 "foo.c" 2
#warning bonkta


we now produce these three warnings:

#1:
In file included from foo.c:3:
In file included from bar.c:42:
bar2.c:143:2: warning: #warning zappa
#warning zappa
 ^

#2:
In file included from foo.c:3:
bar.c:92:2: warning: #warning gonzo
#warning gonzo
 ^

#3:
foo.c:102:2: warning: #warning bonkta
#warning bonkta
 ^

llvm-svn: 63722
2009-02-04 06:25:26 +00:00
Chris Lattner e7bfe52046 # 42 doesn't change system header state either, add test.
llvm-svn: 63721
2009-02-04 05:36:14 +00:00
Chris Lattner 95d9c5e778 make getFileCharacteristic linetable aware. line markers that
play around with the 'is system header' bit now function correctly.

llvm-svn: 63720
2009-02-04 05:33:01 +00:00
Chris Lattner 7941b81498 Add simple #line directive test.
llvm-svn: 63713
2009-02-04 02:17:09 +00:00
Chris Lattner be70ced6a6 add testcase for PR3437 and r63405
llvm-svn: 63407
2009-01-30 18:49:16 +00:00
Chris Lattner f1ca7d3e02 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.

llvm-svn: 63098
2009-01-27 07:57:44 +00:00
Chris Lattner bf648a3a63 Fix a bug that I noticed by inspection.
llvm-svn: 63094
2009-01-27 05:34:03 +00:00
Chris Lattner 76e689636b add parsing and constraint enforcement for GNU line marker directives.
llvm-svn: 63003
2009-01-26 06:19:46 +00:00
Chris Lattner 5a8057bc18 add another sanity test.
llvm-svn: 63001
2009-01-26 05:44:13 +00:00
Chris Lattner 100c65e810 parse and enforce required constraints on #line directives. Right now
we just discard them.

llvm-svn: 62999
2009-01-26 05:29:08 +00:00
Chris Lattner fc014f80e5 fix rdar://6505352 - Bogus warning with -WUndef, a case
Anders noticed.

llvm-svn: 62472
2009-01-18 21:18:58 +00:00
Chris Lattner 5eef507b32 Make -E mode propagate #pragma comment's into the output.
llvm-svn: 62339
2009-01-16 19:25:54 +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
Chris Lattner 53e384f633 Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location.
This is more concrete and useful, tokens aren't really physical objects!

llvm-svn: 62309
2009-01-16 07:00:02 +00:00
Daniel Dunbar 0132cdc45c Add test case for __ASSEMBLER__ definition.
llvm-svn: 60363
2008-12-01 19:23:47 +00:00
Chris Lattner adcbb7f85d testcase for PR3096
llvm-svn: 59794
2008-11-21 06:19:48 +00:00
Torok Edwin c63831dd6a remove this testcase, it fails with -verify still
llvm-svn: 59539
2008-11-18 18:48:14 +00:00
Nuno Lopes b4e7e859e2 fix test. it now crashes, but thats another problem..
llvm-svn: 59537
2008-11-18 17:57:01 +00:00
Torok Edwin 1403f404da add testcase for PR3093
llvm-svn: 59534
2008-11-18 17:31:32 +00:00
Mike Stump c60dcc25dd Skip random pathname characters better. I had a 5 in mine.
llvm-svn: 58291
2008-10-27 22:49:55 +00:00
Chris Lattner fc7d4a3bd2 Add a new -dump-raw-tokens option, which allows us to see raw tokens.
Rename -dumptokens to -dump-tokens.

llvm-svn: 57405
2008-10-12 05:03:36 +00:00
Chris Lattner 464e17ab20 switch to using -verify
llvm-svn: 57068
2008-10-04 19:43:25 +00:00
Chris Lattner 6bea488c79 testcase for my previous patch.
llvm-svn: 56670
2008-09-26 18:07:51 +00:00
Steve Naroff c84e8b779e - Implement __block.
- Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions.

llvm-svn: 55639
2008-09-02 18:50:17 +00:00
Nico Weber 5a87265775 make test fails if llvm is checked out to llvm-svn of if there is a dash somewhere else in the path. fix that.
llvm-svn: 55175
2008-08-22 09:33:51 +00:00
Nuno Lopes 8a48c2f7d9 fix test
llvm-svn: 53802
2008-07-19 22:11:43 +00:00
Ted Kremenek f487548c17 Patch by Kovarththanan Rajaratnam:
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."

llvm-svn: 53797
2008-07-19 19:10:40 +00:00
Argyrios Kyrtzidis 351763e156 Multiple tests in a single test file must be linked with '&&'.
Otherwise, failing tests other than the last one will not be reported.

llvm-svn: 52231
2008-06-12 12:40:02 +00:00
Chris Lattner d330036c06 The awesome GNU "comma elision extension" works with both the standard
__VA_ARGS__ syntax as well as with the amazingly awesome GNU "named 
variadic macro" extension.  Allow it with the GNU syntax as well.

llvm-svn: 50843
2008-05-08 05:10:33 +00:00
Chris Lattner db65ff7223 Fix a few more bugs in preprocessor expressions w.r.t. ?:. Now I
think it is really right. :)  This fixes PR2284.

llvm-svn: 50665
2008-05-05 20:07:41 +00:00
Chris Lattner 3c57f7ebab fix a bug handling right associative operators that Neil noticed, hopefully
the final part of PR2279

llvm-svn: 50635
2008-05-05 04:10:51 +00:00
Chris Lattner d89e458ce0 Fix the rest of PR2279:
a) correct rejection of ',' in pp expressions.
b) the precedence of ',' was wrong w.r.t. ?:.

Thanks again to Neil for finding these and providing testcases.

llvm-svn: 50625
2008-05-04 18:36:18 +00:00
Chris Lattner a08f869c22 Fix PR2279 part C: shifts don't perform the UACs, thanks to Neil
for pointing this out.

llvm-svn: 50624
2008-05-04 18:25:32 +00:00
Chris Lattner 0a9718eab0 fix a nasty bug that Neil identifier in pp-expr parsing (this is PR2279 part D).
llvm-svn: 50617
2008-05-04 07:15:21 +00:00
Chris Lattner f8f945499c Fix PR2220, making diagnostics for unexpected tokens in pp expressions
more nice.

llvm-svn: 49619
2008-04-13 20:38:43 +00:00