summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Silence 'may be used uninitialized' warnings.Argyrios Kyrtzidis2011-08-241-2/+2
| | | | llvm-svn: 138475
* Amend r138129 (reduction of SLocEntries) which introduced performance ↵Argyrios Kyrtzidis2011-08-231-18/+46
| | | | | | | | | | | | | | | | | | | | | | regression due to increased calls to SourceManager::getFileID. (rdar://9992664) Use a slightly different approach that is more efficient both in terms of speed (no extra getFileID calls) and in SLocEntries reduction. Comparing pre-r138129 and this patch we get: For compiling SemaExpr.cpp reduction of SLocEntries by 26%. For the boost enum library: -SLocEntries -34% (note that this was -5% for r138129) -Memory consumption -50% -PCH size -31% Reduced SLocEntries also benefit the hot function SourceManager::getFileID, evident by the reduced "FileID scans". llvm-svn: 138380
* Introduce SourceManager::isInSLocAddrSpace and use it in TokenLexer instead ↵Argyrios Kyrtzidis2011-08-231-12/+9
| | | | | | | | of isInFileID since it is a bit more efficient. llvm-svn: 138379
* Rename SourceManager::isBeforeInSourceLocationOffset -> isBeforeInSLocAddrSpace.Argyrios Kyrtzidis2011-08-231-2/+1
| | | | llvm-svn: 138378
* TokenLexer::getExpansionLocForMacroDefLoc doesn't need to return an invalid ↵Argyrios Kyrtzidis2011-08-231-29/+16
| | | | | | SourceLocation. llvm-svn: 138377
* In Lexer::isAtEndOfMacroExpansion use SourceManager::isInFileID and avoidArgyrios Kyrtzidis2011-08-231-5/+3
| | | | | | the extra SourceManager::getFileID call. llvm-svn: 138376
* Don't warn on varaidic macros in C++0x mode.Eli Friedman2011-08-221-2/+2
| | | | llvm-svn: 138257
* Boost the efficiency of SourceManager::getMacroArgExpandedLocation.Argyrios Kyrtzidis2011-08-212-0/+18
| | | | | | | | | | | | | | | | | | Currently getMacroArgExpandedLocation is very inefficient and for the case of a location pointing at the main file it will end up checking almost all of the SLocEntries. Make it faster: -Use a map of macro argument chunks to their expanded source location. The map is for a single source file, it's stored in the file's ContentCache and lazily computed, like the source lines cache. -In SLocEntry's FileInfo add an 'unsigned NumCreatedFIDs' field that keeps track of the number of FileIDs (files and macros) that were created during preprocessing of that particular file SLocEntry. This is useful when computing the macro argument map in skipping included files while scanning for macro arg FileIDs that lexed from a specific source file. Due to padding, the new field does not increase the size of SLocEntry. llvm-svn: 138225
* For assigning SourceLocations to macro arg tokens, reserve a single SLocEntryArgyrios Kyrtzidis2011-08-191-22/+69
| | | | | | | | | | | | | | for tokens that are lexed consecutively from the same FileID, instead of creating a SLocEntry for each token. e.g for assert(foo == bar); there will be a single SLocEntry for the "foo == bar" chunk and locations for the 'foo', '==', 'bar' tokens will point inside that chunk. For parsing SemaExpr.cpp, this reduced the number of SLocEntries by 25%. llvm-svn: 138129
* Rename TokenLexer::getMacroExpansionLocation -> ↵Argyrios Kyrtzidis2011-08-191-8/+10
| | | | | | getExpansionLocForMacroDefLoc, no functionality change. llvm-svn: 138128
* Warn about and truncate UCNs that are too big for their character literal type.Craig Topper2011-08-191-5/+5
| | | | llvm-svn: 138031
* [libclang] Support code-completion inside macro arguments.Argyrios Kyrtzidis2011-08-181-1/+17
| | | | llvm-svn: 137973
* For the MacroExpands preprocessor callback, also pass the SourceRangeArgyrios Kyrtzidis2011-08-182-7/+10
| | | | | | of expansion (for function macros it includes the right paren). llvm-svn: 137909
* Make Lexer::GetBeginningOfToken able to handle macro arg expansion locations.Argyrios Kyrtzidis2011-08-171-3/+23
| | | | llvm-svn: 137795
* De-Unicode-ify.NAKAMURA Takumi2011-08-121-2/+2
| | | | llvm-svn: 137430
* Raw string followup. Pass a couple StringRefs by value.Craig Topper2011-08-112-2/+2
| | | | llvm-svn: 137301
* Add support for C++0x raw string literals.Craig Topper2011-08-113-110/+335
| | | | llvm-svn: 137298
* Fix comment (test commit)Craig Topper2011-08-081-1/+1
| | | | llvm-svn: 137039
* Add a __has_feature macro for generalized initializers, turned offAlexis Hunt2011-08-071-0/+1
| | | | | | because we don't support them yet. llvm-svn: 137027
* Comment the weird behavior of __has_feature(is_empty) and __has_feature(is_pod)Douglas Gregor2011-08-031-0/+8
| | | | llvm-svn: 136788
* A couple fixes for preprocessor expressions:Eli Friedman2011-08-031-9/+13
| | | | | | | | | | | 1. Be more tolerant of comments in -CC (comment-preserving) mode. We were missing a few cases. 2. Make sure to expand the second FOO in "#if defined FOO FOO". (See also r97253, which addressed the case of "#if defined(FOO FOO".) Fixes PR10286. llvm-svn: 136748
* 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
OpenPOWER on IntegriCloud