summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PTH: Fix remaining cases where the spelling cache in the PTH file was being ↵Ted Kremenek2009-01-131-13/+35
| | | | | | missed when it shouldn't. This shaves another 7% off PTH time for -Eonly on Cocoa.h llvm-svn: 62186
* PTH:Ted Kremenek2009-01-081-1/+19
| | | | | | | | | | - Added stub PTHLexer::getSpelling() that will be used for fetching cached spellings from the PTH file. This doesn't do anything yet. - Added a hook in Preprocessor::getSpelling() to call PTHLexer::getSpelling() when using a PTHLexer. - Updated PTHLexer to read the offsets of spelling tables in the PTH file. llvm-svn: 61911
* simplify Preprocessor::getSpelling now that identifiers carry aroundChris Lattner2009-01-051-7/+1
| | | | | | their length. llvm-svn: 61734
* Add parser support for __forceinline, __w64, __ptr64.Steve Naroff2008-12-251-3/+0
| | | | llvm-svn: 61431
* Add parser support for __cdecl, __stdcall, and __fastcall.Steve Naroff2008-12-251-3/+1
| | | | | | Change preprocessor implementation of _cdecl to reference __cdecl. llvm-svn: 61430
* Add explicit "fuzzy" parse support for Microsoft declspec.Steve Naroff2008-12-241-1/+0
| | | | | | Remove previous __declspec macro that would effectively erase the construct prior to parsing. llvm-svn: 61422
* Don't define __STDC__ when compiling with -fms-extensionsSteve Naroff2008-12-181-1/+2
| | | | llvm-svn: 61223
* Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead ↵Ted Kremenek2008-12-151-3/+3
| | | | | | using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%. llvm-svn: 61042
* Add LangOptions marker for assembler-with-cpp mode and use to defineDaniel Dunbar2008-12-011-1/+2
| | | | | | | __ASSEMBLER__ properly. Patch from Roman Divacky (with minor formatting changes). Thanks! llvm-svn: 60362
* Move the Preprocessor::Diag methods inline. This has the interestingChris Lattner2008-11-221-12/+0
| | | | | | | | | | | | | | | | (and carefully calculated) effect of allowing the compiler to reason about the aliasing properties of DiagnosticBuilder object better, allowing the whole thing to be promoted to registers instead of resulting in a ton of stack traffic. While I'm not very concerned about the performance of the Diag() method invocations, I *am* more concerned about their code size and impact on the non-diagnostic code. This patch shrinks the clang executable (in release-asserts mode with gcc-4.2) from 14523980 to 14519816 bytes. This isn't much, but it shrinks the lexer from 38192 to 37776, PPDirectives.o from 31116 to 28868 bytes, etc. llvm-svn: 59862
* inline a method into its only two call sites.Chris Lattner2008-11-221-2/+3
| | | | llvm-svn: 59860
* Split the DiagnosticInfo class into two disjoint classes:Chris Lattner2008-11-221-2/+2
| | | | | | | | | | one for building up the diagnostic that is in flight (DiagnosticBuilder) and one for pulling structured information out of the diagnostic when formatting and presenting it. There is no functionality change with this patch. llvm-svn: 59849
* Move more cases of using 'CurLexer' to 'CurPPLexer'.Ted Kremenek2008-11-191-1/+1
| | | | | | Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer. llvm-svn: 59671
* Remove Preprocessor::CacheTokens boolean data member. The same functionality ↵Argyrios Kyrtzidis2008-11-191-1/+0
| | | | | | can be provided by using Preprocessor::isBacktrackEnabled(). llvm-svn: 59631
* Initialize CurPPLexer in Preprocessor's constructor.Ted Kremenek2008-11-191-1/+1
| | | | llvm-svn: 59573
* Remove the last of the old-style Preprocessor::Diag methods.Chris Lattner2008-11-181-24/+0
| | | | llvm-svn: 59554
* Convert the lexer and start converting the PP over to using canonical Diag ↵Chris Lattner2008-11-181-2/+7
| | | | | | methods. llvm-svn: 59511
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-181-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are formed. In particular, a diagnostic with all its strings and ranges is now packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a ton of random stuff. This has the benefit of simplifying the interface, making it more extensible, and allowing us to do more checking for things like access past the end of the various arrays passed in. In addition to introducing DiagnosticInfo, this also substantially changes how Diagnostic::Report works. Instead of being passed in all of the info required to issue a diagnostic, Report now takes only the required info (a location and ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to stuff strings and ranges into the DiagnosticInfo with the << operator. When the dtor runs on the DiagnosticInfo object (which should happen at the end of the statement), the diagnostic is actually emitted with all of the accumulated information. This is a somewhat tricky dance, but it means that the accumulated DiagnosticInfo is allowed to keep pointers to other expression temporaries without those pointers getting invalidated. This is just the minimal change to get this stuff working, but this will allow us to eliminate the zillions of variant "Diag" methods scattered throughout (e.g.) sema. For example, instead of calling: Diag(BuiltinLoc, diag::err_overload_no_match, typeNames, SourceRange(BuiltinLoc, RParenLoc)); We will soon be able to just do: Diag(BuiltinLoc, diag::err_overload_no_match) << typeNames << SourceRange(BuiltinLoc, RParenLoc)); This scales better to support arbitrary types being passed in (not just strings) in a type-safe way. Go operator overloading?! llvm-svn: 59502
* Change the diagnostics interface to take an array of pointers to Chris Lattner2008-11-181-2/+4
| | | | | | | | strings instead of array of strings. This reduces string copying in some not-very-important cases, but paves the way for future improvements. llvm-svn: 59494
* Using llvm::OwningPtr<> for CurLexer and CurTokenLexer. This makes both the ↵Ted Kremenek2008-11-131-3/+0
| | | | | | ownership semantics of these objects explicit within the Preprocessor and also tightens up the code (explicit deletes not needed). llvm-svn: 59249
* Fixed build warning. No functionality change.Sanjiv Gupta2008-10-311-2/+2
| | | | llvm-svn: 58503
* Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wcharSanjiv Gupta2008-10-311-34/+61
| | | | | | | | | | etc more generic. For some targets, long may not be equal to pointer size. For example: PIC16 has int as i16, ptr as i16 but long as i32. Also fixed a few build warnings in assert() functions in CFRefCount.cpp, CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp. llvm-svn: 58501
* __CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTRChris Lattner2008-10-061-4/+4
| | | | | | won't expand to the builtin. This fixes rdar://6248329 llvm-svn: 57164
* move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ intoChris Lattner2008-10-051-4/+10
| | | | | | target indep code. llvm-svn: 57139
* suck the rest of the FP macros out of the targets into the PPChris Lattner2008-10-051-4/+42
| | | | llvm-svn: 57137
* start moving fp macros overChris Lattner2008-10-051-2/+38
| | | | llvm-svn: 57134
* move a bunch more integer sizing out of target-specific code intoChris Lattner2008-10-051-0/+49
| | | | | | | | | | target indep code. Note that this changes functionality on PIC16: it defines __INT_MAX__ correctly for it, and it changes sizeof(long) to 16-bits (to match the size of pointer). llvm-svn: 57132
* eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start movingChris Lattner2008-10-051-6/+23
| | | | | | integer size #defines over to the Preprocessor. llvm-svn: 57130
* gcc no longer defines __block to nothing when blocks aren't enabled.Chris Lattner2008-10-051-4/+1
| | | | llvm-svn: 57129
* rearrange preprocessor macro definitions into language-specificChris Lattner2008-10-051-44/+51
| | | | | | then target specific. llvm-svn: 57128
* Implement PR2773, support for __USER_LABEL_PREFIX__Chris Lattner2008-10-051-0/+7
| | | | llvm-svn: 57127
* define __PASCAL_STRINGS__ whenever -fpascal-strings is enabled.Chris Lattner2008-09-301-0/+4
| | | | llvm-svn: 56824
* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is a darwin-specific #defineChris Lattner2008-09-301-1/+1
| | | | llvm-svn: 56822
* Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfoChris Lattner2008-09-261-11/+0
| | | | | | | | | | | 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
* Update clang to pretend to be gcc-4.2.Daniel Dunbar2008-09-261-4/+4
| | | | | | - This really needs to be automated and configurable. llvm-svn: 56635
* Fix <rdar://problem/6240065> clang: __BLOCKS__ should be defined.Steve Naroff2008-09-231-2/+3
| | | | llvm-svn: 56503
* - Implement __block.Steve Naroff2008-09-021-3/+10
| | | | | | - Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions. llvm-svn: 55639
* Pull code from last commit. will put back soon.Steve Naroff2008-09-021-7/+0
| | | | llvm-svn: 55637
* Implement block pseudo-storage class modifiers (__block, __byref).Steve Naroff2008-09-021-0/+7
| | | | llvm-svn: 55635
* Add a safety check.Argyrios Kyrtzidis2008-08-231-0/+2
| | | | | | Make sure there's no "dangling" backtrack position when Preprocessor is destroyed. llvm-svn: 55236
* Move some ObjC preprocessor definitions intoDaniel Dunbar2008-08-121-1/+18
| | | | | | | InitializePredefinedMacros(). - Also now properly wired to -fobjc-gc, -fnext-runtime. llvm-svn: 54661
* remove obsolete comment.Chris Lattner2008-08-111-13/+0
| | | | llvm-svn: 54652
* * Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber2008-08-101-0/+11
| | | | | | | | | | | | | | | | * 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
* Allow the preprocessor to cache the lexed tokens, so that we can do ↵Argyrios Kyrtzidis2008-08-101-1/+3
| | | | | | | | | | | | | | | 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
* Patch byTed Kremenek2008-07-191-1/+1
| | | | | | | "When dumping the tokens (-dumptokens output type), the column numbers are not correctly shown. This patch fixes that issue." llvm-svn: 53796
* move the linux predefined macro definition to the TargetInfo, where it ↵Nuno Lopes2008-07-051-5/+0
| | | | | | really belongs llvm-svn: 53149
* predefine the macro linux when compiled on a linux system. this fixes the ↵Nuno Lopes2008-07-051-0/+5
| | | | | | build of libtidy llvm-svn: 53145
* clang uses the llvm backend, so define __llvm__ like llvm-gcc. Chris Lattner2008-06-261-0/+3
| | | | | | | Additionally, define __clang__ so clients can predicate based on clang features. llvm-svn: 52788
* Fix rewriter bug <rdar://problem/5929344> clang ObjC rewriter: "extern int ↵Steve Naroff2008-05-151-0/+2
| | | | | | | | __CFConstantStringClassReference[];" should be extern "C". Have clang predefine OBJC_NEW_PROPERTIES (which is what gcc does). llvm-svn: 51163
* DO NOT pre-defined __OBJC2__. The __OBJC2__ macro should only be defined ↵Steve Naroff2008-05-091-2/+0
| | | | | | 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
OpenPOWER on IntegriCloud