summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Fix a thinko in my __is_empty/__is_pod commit.Douglas Gregor2011-07-301-2/+6
| | | | llvm-svn: 136561
* Turn off __has_feature(is_empty) and __has_feature(is_pod) if theDouglas Gregor2011-07-301-2/+4
| | | | | | | libstdc++ hack has reverted these type traits to keywords. Icky, but fixes <rdar://problem/9836262>. llvm-svn: 136560
* Use the "Bar.h" -> <Foo/Bar.h> remapping for index header maps only asDouglas Gregor2011-07-301-16/+23
| | | | | | | a fallback, if normal header search fails. Another attempt at <rdar://problem/9824020>. llvm-svn: 136557
* Introduce the "-index-header-map" option, to give special semanticsDouglas Gregor2011-07-281-3/+35
| | | | | | | for quoted header lookup when dealing with not-yet-installed frameworks. Fixes <rdar://problem/9824020>. llvm-svn: 136331
* Add a utility function to the Lexer, which makes it easier to find a token ↵Anna Zaks2011-07-271-0/+59
| | | | | | after the given location. (It is a generalized version of trans::findLocationAfterSemi from ArcMigrate, which will be changed to use the Lexer utility). llvm-svn: 136268
* Change Preprocessor::getTotalMemory() to use llvm::capacity_in_bytes().Ted Kremenek2011-07-271-5/+6
| | | | llvm-svn: 136239
* Change PreprocessingRecord::getTotalMemory() to use llvm::capacity_in_bytes().Ted Kremenek2011-07-271-3/+4
| | | | llvm-svn: 136238
* Change HeaderSearch::getTotalMemory() to use llvm::capacity_in_bytes().Ted Kremenek2011-07-271-2/+3
| | | | llvm-svn: 136237
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-277-123/+209
| | | | llvm-svn: 136210
* clang_getCXTUResourceUsage: report memory used by HeaderSearch.Ted Kremenek2011-07-261-1/+7
| | | | | | | This required converting the StringMaps to use a BumpPtrAllocator. I measured the compile time and saw no observable regression. llvm-svn: 136190
* Report more memory using in Preprocessor::getTotalMemory() and ↵Ted Kremenek2011-07-262-1/+14
| | | | | | | | | | PreprocessingRecord::getTotalMemory(). Most of the memory was already reported; but now we report more memory from side data structures. Fixes <rdar://problem/9379717>. llvm-svn: 136150
* Migrate 'Instantiation' data and API bits of SLocEntry to 'Expansion'Chandler Carruth2011-07-261-3/+2
| | | | | | | | etc. With this I think essentially all of the SourceManager APIs are converted. Comments and random other bits of cleanup should be all thats left. llvm-svn: 136057
* Convert InstantiationInfo and much of the related code to ExpansionInfoChandler Carruth2011-07-261-2/+2
| | | | | | | | | and various other 'expansion' based terms. I've tried to reformat where appropriate and catch as many references in comments but I'm going to do several more passes. Also I've tried to expand parameter names to be more clear where appropriate. llvm-svn: 136056
* Rename create(MacroArg)InstantiationLoc to create(MacroArg)ExpansionLoc.Chandler Carruth2011-07-264-34/+32
| | | | llvm-svn: 136054
* Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.Chandler Carruth2011-07-252-4/+4
| | | | llvm-svn: 135962
* Rename SourceManager::getImmediateInstantiationRange toChandler Carruth2011-07-251-1/+1
| | | | | | getImmediateExpansionRange. llvm-svn: 135960
* Rename SourceManager::getInstantiationRange to getExpansionRange.Chandler Carruth2011-07-252-2/+2
| | | | llvm-svn: 135915
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-252-2/+2
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-231-1/+1
| | | | | | Mulder! llvm-svn: 135855
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-2312-88/+86
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Rework the detailed preprocessing record to separate preprocessingDouglas Gregor2011-07-211-31/+18
| | | | | | | | | | | | | | | entities generated directly by the preprocessor from those loaded from the external source (e.g., the ASTReader). By separating these two sets of entities into different vectors, we allow both to grow independently, and eliminate the need for preallocating all of the loaded preprocessing entities. This is similar to the way the recent SourceManager refactoring treats FileIDs and the source location address space. As part of this, switch over to building a continuous range map to track preprocessing entities. llvm-svn: 135646
* SpellingJoerg Sonnenberger2011-07-201-1/+1
| | | | llvm-svn: 135545
* Revamp the SourceManager to separate the representation of parsedDouglas Gregor2011-07-192-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | source locations from source locations loaded from an AST/PCH file. Previously, loading an AST/PCH file involved carefully pre-allocating space at the beginning of the source manager for the source locations and FileIDs that correspond to the prefix, and then appending the source locations/FileIDs used for parsing the remaining translation unit. This design forced us into loading PCH files early, as a prefix, whic has become a rather significant limitation. This patch splits the SourceManager space into two parts: for source location "addresses", the lower values (growing upward) are used to describe parsed code, while upper values (growing downward) are used for source locations loaded from AST/PCH files. Similarly, positive FileIDs are used to describe parsed code while negative FileIDs are used to file/macro locations loaded from AST/PCH files. As a result, we can load PCH/AST files even during parsing, making various improvemnts in the future possible, e.g., teaching #include <foo.h> to look for and load <foo.h.gch> if it happens to be already available. This patch was originally written by Sebastian Redl, then brought forward to the modern age by Jonathan Turner, and finally polished/finished by me to be committed. llvm-svn: 135484
* Remember to add a has_feature macro for __underlying_type now that it isAlexis Hunt2011-07-181-0/+1
| | | | | | correctly impelmented llvm-svn: 135401
* Move the rest of the preprocessor terminology from 'instantiate' andChandler Carruth2011-07-143-25/+24
| | | | | | | | | | | | | variants to 'expand'. This changed a couple of public APIs, including one public type "MacroInstantiation" which is now "MacroExpansion". The rest of the codebase was updated to reflect this, especially the libclang code. Two of the C++ (and thus easily changed) libclang APIs were updated as well because they pertained directly to the old MacroInstantiation class. No functionality changed. llvm-svn: 135139
* Convert terminology in the Lexer from 'instantiate' and variants toChandler Carruth2011-07-141-26/+27
| | | | | | | | | 'expand'. Also update the public API it provides to the new term, and propagate that update to the various clients. No functionality changed. llvm-svn: 135138
* Switch the TokenLexer's terminology from various forms of 'instantiate'Chandler Carruth2011-07-141-21/+21
| | | | | | | | | to 'expand' for macros. Only comments and uses local to the TokenLexer are updated. No functionality changed. llvm-svn: 135137
* Implement -MG. Fixes PR9613Peter Collingbourne2011-07-122-5/+6
| | | | llvm-svn: 134996
* Don't warn for unused macro when undef'ing it, if it comes from an included ↵Argyrios Kyrtzidis2011-07-111-1/+1
| | | | | | file. rdar://9745065 llvm-svn: 134919
* Fix up dependency file name printing to more closely match that of gcc, ↵Eli Friedman2011-07-081-4/+2
| | | | | | | | including fixing a nasty recent regression that could make us print "/foo.h" with a command-line including "-I ./". rdar://problem/9734352 llvm-svn: 134728
* Tweak formatting.Chandler Carruth2011-07-081-1/+1
| | | | llvm-svn: 134675
* Switch the token-paste source locations inside of function style macroChandler Carruth2011-07-081-3/+3
| | | | | | | | argument expansion to use the macro argument source locations as well. Add a few tests to exercise this. There is still a bit more work needed here though. llvm-svn: 134674
* Keep track of which source locations are part of a macro argumentChandler Carruth2011-07-071-3/+3
| | | | | | | | | | | | | | | | | | | | instantiation and improve diagnostics which are stem from macro arguments to trace the argument itself back through the layers of macro expansion. This requires some tricky handling of the source locations, as the argument appears to be expanded in the opposite direction from the surrounding macro. This patch provides helper routines that encapsulate the logic and explain the reasoning behind how we step through macros during diagnostic printing. This fixes the rest of the test cases originially in PR9279, and later split out into PR10214 and PR10215. There is still some more work we can do here to improve the macro backtrace, but those will follow as separate patches. llvm-svn: 134660
* Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the ↵Argyrios Kyrtzidis2011-07-071-1/+52
| | | | | | Lexer, since they depend on it now. llvm-svn: 134644
* Turn hashhash into tok::unkwown when it comes from expanding an argument, ↵Argyrios Kyrtzidis2011-07-071-8/+19
| | | | | | per Chris' suggestion. llvm-svn: 134621
* When expanding macro arguments, treat '##' coming from an argument as a ↵Argyrios Kyrtzidis2011-07-071-5/+12
| | | | | | | | | | | normal token. e.g. #define M(x) A x B M(##) // should expand to 'A ## B', not 'AB' llvm-svn: 134588
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-075-17/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) llvm-svn: 134587
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-1/+1
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Replace an unreachable error path with an assertPeter Collingbourne2011-06-301-4/+1
| | | | | | | (SourceManager::createFileID cannot return an invalid file ID). Also update a comment to reflect this. llvm-svn: 134168
* Introduce a caching mechanism for macro expanded tokens.Argyrios Kyrtzidis2011-06-294-10/+53
| | | | | | | | | | | | | | | Previously macro expanded tokens were added to Preprocessor's bump allocator and never released, even after the TokenLexer that were lexing them was finished, thus they were wasting memory. A very "useful" boost library was causing clang to eat 1 GB just for the expanded macro tokens. Introduce a special cache that works like a stack; a TokenLexer can add the macro expanded tokens in the cache, and when it finishes, the tokens are removed from the end of the cache. Now consumed memory by expanded tokens for that library is ~ 1.5 MB. Part of rdar://9327049. llvm-svn: 134105
* Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no ↵Argyrios Kyrtzidis2011-06-291-0/+4
| | | | | | functionality change. llvm-svn: 134103
* Allow Lexer::getLocForEndOfToken to return the location just passed the ↵Argyrios Kyrtzidis2011-06-241-2/+10
| | | | | | | | | | macro instantiation if the location given points at the last token of the macro instantiation. Fixes rdar://9045701. llvm-svn: 133804
* Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!Douglas Gregor2011-06-221-4/+13
| | | | llvm-svn: 133633
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-212-11/+6
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Automatic Reference Counting.John McCall2011-06-151-0/+5
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* revert r133003 and fix the bug properly: the issue was that ## in a tokenChris Lattner2011-06-141-5/+5
| | | | | | | | | | lexer is not a paste operator, it is a normal token. This fixes a conformance issue shown here: http://p99.gforge.inria.fr/c99-conformance/c99-conformance-clang-2.9.html and it defines away the crash from before. llvm-svn: 133005
* Fix a crash on the testcase in PR9981 / rdar://9486765.Chris Lattner2011-06-141-3/+4
| | | | llvm-svn: 133003
* Copy IsWarnIfUnused too when making a copy of a MacroInfo.Benjamin Kramer2011-06-031-0/+1
| | | | | | Found by valgrind. llvm-svn: 132540
* Disable MSVC warning about runtime stack overflow for DebugOverflowStack.Francois Pichet2011-05-251-0/+8
| | | | llvm-svn: 132059
* A StringRef-ication of the DiagnosticIDs API and internals.Argyrios Kyrtzidis2011-05-251-3/+2
| | | | | | | | | Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static diagnostic data structures, which resulted in a huge global-var-init function. Depends on llvm commit r132046. llvm-svn: 132047
OpenPOWER on IntegriCloud