Commit Graph

27 Commits

Author SHA1 Message Date
Steve Naroff ad91868aa6 Fix rewriter bug <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C".
Have clang predefine OBJC_NEW_PROPERTIES (which is what gcc does).

llvm-svn: 51163
2008-05-15 21:12:10 +00:00
Steve Naroff 530c3f9403 DO NOT pre-defined __OBJC2__. The __OBJC2__ macro should only be defined when targeting the new, Apple 2.0 *runtime ABI*. It is not intended to be used to #ifdef ObjC 2.0 langauge features. This is unfortunate (given it's name). In a perfect world, this defined would be named __OBJC2_RUNTIME_ABI__. Oh well.
llvm-svn: 50913
2008-05-09 20:52:28 +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 ca2b318233 Fix typo, improve comment.
llvm-svn: 50666
2008-05-05 20:09:27 +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 3565c8e343 Neil pointed out that clang doesn't generate ranges from diagnostics
related to pp-expressions.  Doing so is pretty simple and this
patch implements it, yielding nice diagnostics like:

t.c:2:7: error: division by zero in preprocessor expression
#if 1 / (0 + 0)
    ~ ^ ~~~~~~~
t.c:5:14: error: expected ')' in preprocessor expression
#if (412 + 42
     ~~~~~~~~^
t.c:5:5: error: to match this '('
#if (412 + 42
    ^
t.c:10:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
     ~~~ ^ ~~
t.c:10:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
    ~~~~~~~~~~ ^ ~~
5 diagnostics generated.

llvm-svn: 50638
2008-05-05 06:45:50 +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 ca671b0e51 ||/&& do not do UAC's either. This silences a bogus warning on #if -1 || 4U.
llvm-svn: 50632
2008-05-04 23:46:17 +00:00
Chris Lattner 4af72c76dd Neil points out that commas don't do UACs either.
llvm-svn: 50631
2008-05-04 23:38:48 +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 4885b97664 for exponent-related errors, emit the diagnostic on the 'e' or 'p'.
llvm-svn: 49997
2008-04-20 18:47:55 +00:00
Chris Lattner 48a9b9beeb when emitting diagnostics about some character in a numeric
literal, indicate what character the error is about or where
it would be.  For example:

pr2241.c:1:17: error: exponent has no digits
float f[] = { 1e  , 1ee0 };
                ^

llvm-svn: 49996
2008-04-20 18:41:46 +00:00
Chris Lattner ba1f37bfdf simplify ownership of the predefines buffer.
llvm-svn: 49973
2008-04-19 23:09:31 +00:00
Ted Kremenek f42f3fb47d class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.
clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
  passes it to the preprocessor object.
  
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.

llvm-svn: 49875
2008-04-17 22:31:54 +00:00
Ted Kremenek 219bab3be9 Added "PreprocessorFactory", an interface for lazily creating Preprocessor objects on-demand.
llvm-svn: 49868
2008-04-17 21:23:07 +00:00
Nate Begeman 5eee93328e Fix typo
llvm-svn: 49632
2008-04-14 02:26:39 +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
Chris Lattner 8f96d04ceb don't diagnose empty source files, thanks Neil!
llvm-svn: 49575
2008-04-12 05:54:25 +00:00
Chris Lattner 9b7206eb4f don't read off the front of the buffer. Thanks to Sam for pointing this out.
llvm-svn: 49535
2008-04-11 16:20:41 +00:00
Steve Naroff a1f414517c Support MS-specific integer suffixes (i8, i16, i32, i64, i128).
llvm-svn: 49229
2008-04-04 21:02:54 +00:00
Chris Lattner 595cf9ff81 Update to match simplified llvm MemoryBuffer interfaces for files.
llvm-svn: 49042
2008-04-01 18:04:30 +00:00
Chris Lattner 22fc992f59 Avoid overflowing buffer, patch by Algeris Kirtzidis!
llvm-svn: 48741
2008-03-24 21:14:55 +00:00
Sam Bishop 27654983dc Plug a memory leak in the "this macro expands into a single trivially-
expanded token" case.

llvm-svn: 48637
2008-03-21 07:13:02 +00:00
Chris Lattner 0725a3e055 move #include to the file that needs it.
llvm-svn: 48485
2008-03-18 05:59:11 +00:00
Chris Lattner 7a51313d8a Make a major restructuring of the clang tree: introduce a top-level
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
2008-03-15 23:59:48 +00:00