Commit Graph

29 Commits

Author SHA1 Message Date
Chris Lattner 4ecd753486 eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
integer size #defines over to the Preprocessor.

llvm-svn: 57130
2008-10-05 19:44:25 +00:00
Chris Lattner 248d3c4192 gcc no longer defines __block to nothing when blocks aren't enabled.
llvm-svn: 57129
2008-10-05 19:32:52 +00:00
Chris Lattner 1f7e2d5430 rearrange preprocessor macro definitions into language-specific
then target specific.

llvm-svn: 57128
2008-10-05 19:32:22 +00:00
Chris Lattner f37bafc5ca Implement PR2773, support for __USER_LABEL_PREFIX__
llvm-svn: 57127
2008-10-05 19:22:37 +00:00
Chris Lattner 7ed3209332 define __PASCAL_STRINGS__ whenever -fpascal-strings is enabled.
llvm-svn: 56824
2008-09-30 00:48:48 +00:00
Chris Lattner 006579ddb5 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is a darwin-specific #define
llvm-svn: 56822
2008-09-30 00:46:39 +00:00
Chris Lattner c88a23e8d7 Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfo
to whether the fileid is a 'extern c system header' in addition to whether it
is a system header, most of this is spreading plumbing around.  Once we have that,
PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to
base the system header state on FileIDInfo instead of HeaderSearch.  Finally,
in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness
of a file being entered can be set due to the #includer or the #includee.

llvm-svn: 56688
2008-09-26 20:12:23 +00:00
Daniel Dunbar b5fe494a2c Update clang to pretend to be gcc-4.2.
- This really needs to be automated and configurable.

llvm-svn: 56635
2008-09-26 01:13:13 +00:00
Steve Naroff de2d5b75c2 Fix <rdar://problem/6240065> clang: __BLOCKS__ should be defined.
llvm-svn: 56503
2008-09-23 21:28:24 +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
Steve Naroff d450bffcf1 Pull code from last commit. will put back soon.
llvm-svn: 55637
2008-09-02 18:04:36 +00:00
Steve Naroff 95bffc74da Implement block pseudo-storage class modifiers (__block, __byref).
llvm-svn: 55635
2008-09-02 15:20:19 +00:00
Argyrios Kyrtzidis 5d240d07f2 Add a safety check.
Make sure there's no "dangling" backtrack position when Preprocessor is destroyed.

llvm-svn: 55236
2008-08-23 12:12:06 +00:00
Daniel Dunbar 2258aa0f27 Move some ObjC preprocessor definitions into
InitializePredefinedMacros().
 - Also now properly wired to -fobjc-gc, -fnext-runtime.

llvm-svn: 54661
2008-08-12 00:21:46 +00:00
Chris Lattner 7b18e35113 remove obsolete comment.
llvm-svn: 54652
2008-08-11 22:03:07 +00:00
Nico Weber 4c3116437c * Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now  
  empty class TextDiagnostic
* Make DiagClient optional for Diagnostic

This fixes the following problems:

* -html-diags (and probably others) does now output the same set of  
  warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on  
  TextDiagnostic
* some code duplication is removed

llvm-svn: 54620
2008-08-10 19:59:06 +00:00
Argyrios Kyrtzidis b3dd1e0889 Allow the preprocessor to cache the lexed tokens, so that we can do efficient lookahead and backtracking.
1) New public methods added:
  -EnableBacktrackAtThisPos
  -DisableBacktrack
  -Backtrack
  -isBacktrackEnabled

2) LookAhead() implementation is replaced with a more efficient one.
3) LookNext() is removed.

llvm-svn: 54611
2008-08-10 13:15:22 +00:00
Ted Kremenek 0fff6d3c06 Patch by
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."

llvm-svn: 53796
2008-07-19 19:10:04 +00:00
Nuno Lopes 3da38fd145 move the linux predefined macro definition to the TargetInfo, where it really belongs
llvm-svn: 53149
2008-07-05 19:32:25 +00:00
Nuno Lopes 9b6de71b7d predefine the macro linux when compiled on a linux system. this fixes the build of libtidy
llvm-svn: 53145
2008-07-05 17:58:44 +00:00
Chris Lattner d1224b2493 clang uses the llvm backend, so define __llvm__ like llvm-gcc.
Additionally, define __clang__ so clients can predicate based on
clang features.

llvm-svn: 52788
2008-06-26 17:26:01 +00:00
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 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 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
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