Граф коммитов

121 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner e9ba32357c Fix CheckEndOfDirective to diagnose lines that contain macros that expand to
zero tokens.  This fixes PR2045, thanks to Neil for finding another 
incredibly subtle corner case :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47203 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-16 01:20:36 +00:00
Dan Gohman 376605b59a Adjust for APInt's isPositive being renamed to isNonNegative.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47091 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:09:49 +00:00
Steve Naroff 705b5b5329 Move Microsoft __declspec hack from the parser to the preprocessor. Since we have no plans to actually implement this construct, it is cleaner to limit the change to the preprocessor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 22:29:58 +00:00
Chris Lattner 9880ba94ca long is 32-bit is on win32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46935 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 21:12:45 +00:00
Steve Naroff b746ce84fb - Add support for fuzzy parsing line-oriented __asm's (yuck).
- Change handling of __w64 to a built-in macro.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 23:24:32 +00:00
Steve Naroff 419154d6d8 Minor cleanup from yesterday's -fms-extension commit. Move __int* MS keywords to predefined macros. This removes some of the MS-madness from Parser::ParseDeclarationSpecifiers().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46852 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 15:26:07 +00:00
Chris Lattner 3f1cc838f9 Implement support for the extremely atrocious MS /##/ extension,
which pastes together a comment.  This is only enabled with 
-fms-extensions of course.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 06:03:59 +00:00
Steve Naroff d62701bc53 Implement -fms-extensions. This allows us to fuzzy parse non-standard MS constructs used in "windows.h".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46838 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 03:50:06 +00:00
Chris Lattner 9415a0cc93 Fix PR1969. stdin has no FileEntry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 05:34:02 +00:00
Chris Lattner 71a3a8d506 Fix a bug where we would incorrectly emit a "cannot paste" error
message when handling the GNU ", ## __VA_ARGS__" extension.  While
I'm at it, flag uses of this as extensions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 07:54:23 +00:00
Chris Lattner 09cf90f6d6 Change the location we return for the EOF token to actually be on the last
line of the file, in the common case where a file ends with a newline.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 00:00:30 +00:00
Chris Lattner 116a4b148e add support for -Wundef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-23 17:19:46 +00:00
Chris Lattner c21d9e4766 Fix PR1936, a crash on malformed #if. Thanks to Neil for
noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 19:34:51 +00:00
Ted Kremenek bdd30c26bd Change uses of std::cerr/std::cout to llvm::Lcerr/llvm::cout, and remove
#include<iostream>.

Patch provided by Sam Bishop.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45962 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 16:44:48 +00:00
Chris Lattner 4d73046173 Fix a nasty corner case that Neil noticed in PR1900, where we would
incorrectly apply the multiple include optimization to files with 
guards like:

#if !defined(x) MACRO

where MACRO could expand to different things in different contexts.
Thanks Neil!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 19:50:27 +00:00
Nate Begeman 6b61602bc7 Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 04:01:26 +00:00
Chris Lattner 3a57077668 simplify the lexer a bit, pulling stuff out of the default case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 17:58:54 +00:00
Chris Lattner 6298b8c021 remove attribution from makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45412 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:02:25 +00:00
Chris Lattner 0bc735ffcf Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:25 +00:00
Ted Kremenek ee53364163 Converted uses of scoped_ptr to OwningPtr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45265 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 19:47:16 +00:00
Ted Kremenek 95041a2029 Interned MainFileID within SourceManager. Since SourceManager is referenced by
both Preprocessor and ASTContext, we no longer need to explicitly pass
MainFileID around in function calls that also pass either Preprocessor or
ASTContext. This resulted in some nice cleanups in the ASTConsumers and the
driver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45228 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 22:51:13 +00:00
Chris Lattner 2243449253 Add support for #pragma mark, which shouldn't warn about bogus tokens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45212 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 19:38:36 +00:00
Chris Lattner 5fb125c255 implement HeaderMap::LookupFile. I think headermaps are done now. All that is
left is this crazy thing called "testing".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45124 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 21:38:04 +00:00
Chris Lattner 1adbf6349d implement enough helper functions to successfully dump out the
contents of the header map.  Look ma, no assumptions about input data
here (aka, corrupt header maps can't crash the compiler - crazy thought).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45122 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 21:06:11 +00:00
Chris Lattner ba83265175 simplify some code, using new scoped_ptr support. Fix a bug in the
cross-endianness case, where we checked the version in the wrong endianness.
Amusingly, the GCC logic that detects mixed endianness hmaps and rejects 
them is dead for this very reason.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45113 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 18:59:44 +00:00
Chris Lattner 98751314c4 Finish hooking up the scaffolding for headermaps. They can now do everything
except resolve lookups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45111 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 18:44:09 +00:00
Chris Lattner 1bfd4a6313 Start reading the headermap header, drop the 'errorstr' argument to
the create method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45109 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 18:34:53 +00:00
Chris Lattner 3af66a9335 Sink getName into DirectoryLookup to simplify the client in clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 17:57:27 +00:00
Chris Lattner 0f441ab20c add headermap.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45095 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 08:22:46 +00:00
Chris Lattner b09e71fd52 finish stubbing out support for HeaderMap. Now we just need an implementation!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45094 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 08:17:39 +00:00
Chris Lattner afded5bbb8 refactor an better comment framework lookup code. This moves it from
HeaderSearch into DirectoryLookup, as a particular framework lookup is 
specific to the directory we are currently querying.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45093 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 08:13:48 +00:00
Chris Lattner df77233665 as it turns out, frameworks and headermaps are orthogonal. Make this so in
the internal representation.  This also fixes a bug where -I foo  -F foo would
not search foo as both a normal and framework include dir.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45092 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 07:52:39 +00:00
Chris Lattner 822da61b74 Step #1 in adding headermap support to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45089 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 06:36:45 +00:00
Chris Lattner 53702cd401 add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44976 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13 01:59:49 +00:00
Ted Kremenek 9c728dc4d8 TargetInfo no longer includes a reference to SourceManager.
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:

    FullLoc.getManager().someMethod(FullLoc.getLocation());
    
instead we have:

    FullLoc.someMethod();
    
Modified TextDiagnostics (and related classes) to use this short-hand.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 22:39:36 +00:00
Ted Kremenek 7a9d49fd2b Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 21:27:55 +00:00
Chris Lattner c3d8d57b01 Add dumping support for locations, make -dumptokens print out the location
info of each token.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44741 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 20:31:55 +00:00
Chris Lattner 0750618b0b start partitioning the diagnostics into two classes: those
that are builtin and those that are aren't.  This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44473 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 22:53:43 +00:00
Christopher Lamb 016765e345 Support floating point literals of the form "1e-16f" which specify an exponent but no decimal point.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 06:06:27 +00:00
Ted Kremenek 32e61bf91f Removed potential buffer overrun (spotted by Neil Booth) when NumericLiteralParser
converts a parsed literal into an APFloat. We are still performing a copy of the
string, which hopefully will be removed eventually for performance reasons. This
version now is at least safe.

Changed rounding in APFloat construction in NumericLiteralParser from rmTowardsZero
to rmNearestTiesToEven.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44422 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 00:54:29 +00:00
Ted Kremenek 427d5af5b6 Added optional pass-by-reference argument "isExact" to
NumericLiteralParser::GetFloatValue(). Upon method return, this flag has the value
true if the returned APFloat can exactly represent the number in the parsed text,
and false otherwise.

Modified the implementation of GetFloatValue() to parse literals using APFloat's
convertFromString method (which allows us to set the value of isExact).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44339 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 23:12:30 +00:00
Chris Lattner 0c3eb29e79 Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
Neil, please review this fix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44285 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 06:50:21 +00:00
Chris Lattner b283298f03 fix a bug Steve noticed, where a #import of the main file itself would fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44178 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 19:07:47 +00:00
Chris Lattner 921e9ff030 Fix a bug handling hex floats in c90 mode, pointed out by Neil.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44120 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 16:14:50 +00:00
Steve Naroff 39d0a27479 Since we are all working on Leopard, change the built-in MacOS X version number (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) to target Leopard. This is only a short term solution, until the clang driver implements the "-mmacosx-version-min" flag (which will compute this value based on the target).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10 18:06:36 +00:00
Steve Naroff 8ee529b567 Implement a more sensible strategy for ObjC built-in types (addressing a long standing FIXME in Sema::GetObjcIdType()).
This removes several gross hacks to work around the previous "lazy" behavior.

Two notes:
- MinimalActions still needs to be taught about the built-in types (This breaks one of the -noop test cases). I started this, then added a FIXME.
- I didn't convert Sema::GetObjcProtoType() yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43567 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 18:42:27 +00:00
Steve Naroff 498856cb30 Checking in some code that is still under construction.
I need to (finally) change the way Class/id/SEL/IMP are built-in...the current approach of doing it in the preprocessor is "broken". The other problem is Sema::GetObjcIdType/GetObjcSelType/GetObjcClassType, the hooks that initialize ASTContext lazily. These built-in types need to be done up front...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43557 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 16:03:04 +00:00
Steve Naroff 9165ad378f Add some plumbing to help cope with rewriting "id<p>", "Class<p>*".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 04:38:33 +00:00
Steve Naroff 09b266eb2a Stop pre-defining objc_msgSend/objc_getClass in the preprocessor. Instead, I generate these declaration on the fly when rewriting a message expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43529 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 23:14:51 +00:00
Chris Lattner d65d8eea9f Avoid using macro expansions, which causes these to come out in -E mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43505 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 17:45:43 +00:00