summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Switch the ID numbers used for submodule IDs in the AST reader over toDouglas Gregor2011-12-011-10/+87
| | | | | | | | a standard global/local scheme, so that submodule definitions will eventually be able to refer to submodules in other top-level modules. We'll need this functionality soonish. llvm-svn: 145549
* Promote ModuleMap::Module to a namespace-scope class in the BasicDouglas Gregor2011-11-301-77/+77
| | | | | | | | | library, since modules cut across all of the libraries. Rename serialization::Module to serialization::ModuleFile to side-step the annoying naming conflict. Prune a bunch of ModuleMap.h includes that are no longer needed (most files only needed the Module type). llvm-svn: 145538
* [PCH] In ASTReader::FinishedDeserializing, after we do ↵Argyrios Kyrtzidis2011-11-301-29/+43
| | | | | | | | | | | | | PassInterestingDeclsToConsumer we may end up having added more pending stuff to do, so go in a loop until everything is cleared out. This fixes the error in rdar://10278815 which has a certain David Lynch-esque quality.. error: unknown type name 'BOOL'; did you mean 'BOOL'? llvm-svn: 145536
* Implement (de-)serialization of the description of a module and itsDouglas Gregor2011-11-301-0/+124
| | | | | | | | | submodules. This information will eventually be used for name hiding when dealing with submodules. For now, we only use it to ensure that the module "key" returned when loading a module will always be a module (rather than occasionally being a FileEntry). llvm-svn: 145497
* [libclang] Fix operations (token annotation, getting cursor, etc.) with a ↵Argyrios Kyrtzidis2011-11-231-0/+8
| | | | | | | | | | | | | | | file region inside an objc container that "contains" other file-level declarations. When getting the array of file-level declarations that overlap with a file region, we failed to report that the region overlaps with an objc container, if the container had other file-level declarations declared lexically inside it. Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST and handling them appropriately. llvm-svn: 145109
* If we're dealing with an overridden buffer in the AST reader, load theDouglas Gregor2011-11-171-2/+4
| | | | | | file as a virtual file with the stored modification time and size. llvm-svn: 144916
* Try to appease the failing buildbot where I can't reproduce the problemDouglas Gregor2011-11-171-2/+4
| | | | llvm-svn: 144879
* Implement (de-)serialization of the buffer contents for an overriddenDouglas Gregor2011-11-161-13/+38
| | | | | | | | | | file in the source manager. This allows us to properly create and use modules described by module map files without umbrella headers (or with incompletely umbrella headers). More generally, we can actually build a PCH file that makes use of file -> buffer remappings, which could be useful in libclang in the future. llvm-svn: 144830
* Add a -cc1-level option -fmodule-name=<name>, which will be used whenDouglas Gregor2011-11-151-0/+4
| | | | | | building modules. llvm-svn: 144680
* [PCH] Load the chained objc categories only after recursive loading is finishedArgyrios Kyrtzidis2011-11-141-0/+8
| | | | | | otherwise we may crash. llvm-svn: 144524
* Fix the signature of the getcontext builtin. Patch by Dimitry Andric.Rafael Espindola2011-11-131-0/+18
| | | | llvm-svn: 144505
* Rename SPECIAL_TYPE_jmp_buf and SPECIAL_TYPE_sigjmp_buf to follow theDouglas Gregor2011-11-111-2/+2
| | | | | | convention of SPECIAL_TYPE*. llvm-svn: 144403
* [PCH] Fix reading from PCH of diagnostic pragmas.Argyrios Kyrtzidis2011-11-091-2/+6
| | | | | | | | | | | In certain cases ASTReader would call the normal DiagnosticsEngine API to initialize the state of diagnostic pragmas but DiagnosticsEngine would try to compare source locations leading to crash because the main FileID was not yet initialized. Yet another case of the ASTReader trying to use the normal APIs and inadvertently breaking invariants. Fix this by having the ASTReader set up the internal state directly. llvm-svn: 144153
* [libclang] Add infrastructure to be able to only deserialize decls in a file ↵Argyrios Kyrtzidis2011-11-031-0/+87
| | | | | | | | region and use it for clang_getCursor. llvm-svn: 143605
* Rework the AST for the initializer of a delegating constructor, soDouglas Gregor2011-11-011-10/+9
| | | | | | | | | that it retains source location information for the type. Aside from general goodness (being able to walk the types described in that information), we now have a proper representation for dependent delegating constructors. Fixes PR10457 (for real). llvm-svn: 143410
* [PCH] Now that we store the location of a decl outside its recordArgyrios Kyrtzidis2011-10-311-3/+3
| | | | | | make sure that we keep track of locations of replaced decls as well. llvm-svn: 143341
* [PCH] For ASTReader's FileDeclIDs also associate the Module that theArgyrios Kyrtzidis2011-10-311-1/+2
| | | | | | local DeclIDs came from. llvm-svn: 143340
* [PCH] Keep track of file-level declarations that are contained by files.Argyrios Kyrtzidis2011-10-281-0/+11
| | | | | | | | | | | | Introduce a FILE_SORTED_DECLS [de]serialization record that contains a file sorted array of file-level DeclIDs in a PCH/Module. The rationale is to allow "targeted" deserialization of decls inside a range of a source file. Cocoa PCH increased by 0.8% Difference of creation time for Cocoa PCH is below the noise level. llvm-svn: 143238
* [PCH] Pull the location out of the serialized declarations and put it in the ↵Argyrios Kyrtzidis2011-10-271-1/+1
| | | | | | | | | | | array of decl bit offsets. This allows us to easily get at the location of a decl without deserializing it. It increases size of Cocoa PCH by only 0.2%. llvm-svn: 143123
* Make the loading of information attached to an IdentifierInfo from anDouglas Gregor2011-10-271-75/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST file more lazy, so that we don't eagerly load that information for all known identifiers each time a new AST file is loaded. The eager reloading made some sense in the context of precompiled headers, since very few identifiers were defined before PCH load time. With modules, however, a huge amount of code can get parsed before we see an @import, so laziness becomes important here. The approach taken to make this information lazy is fairly simple: when we load a new AST file, we mark all of the existing identifiers as being out-of-date. Whenever we want to access information that may come from an AST (e.g., whether the identifier has a macro definition, or what top-level declarations have that name), we check the out-of-date bit and, if it's set, ask the AST reader to update the IdentifierInfo from the AST files. The update is a merge, and we now take care to merge declarations before/after imports with declarations from multiple imports. The results of this optimization are fairly dramatic. On a small application that brings in 14 non-trivial modules, this takes modules from being > 3x slower than a "perfect" PCH file down to 30% slower for a full rebuild. A partial rebuild (where the PCH file or modules can be re-used) is down to 7% slower. Making the PCH file just a little imperfect (e.g., adding two smallish modules used by a bunch of .m files that aren't in the PCH file) tips the scales in favor of the modules approach, with 24% faster partial rebuilds. This is just a first step; the lazy scheme could possibly be improved by adding versioning, so we don't search into modules we already searched. Moreover, we'll need similar lazy schemes for all of the other lookup data structures, such as DeclContexts. llvm-svn: 143100
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-0/+1
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-1/+0
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-0/+1
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
* [PCH] When visiting preprocessed entities, make it possible to avoid ↵Argyrios Kyrtzidis2011-10-251-5/+35
| | | | | | | | | | | | | | | deserializing preprocessed entities that are #included in the range that we are interested. This is useful when we are interested in preprocessed entities of a specific file, e.g when we are annotating tokens. There is also an optimization where we cache the last result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if there is a call with the same range as before. rdar://10313365 llvm-svn: 142887
* Controlling macros are identifiers, not declarations.Douglas Gregor2011-10-171-1/+2
| | | | llvm-svn: 142225
* Add a new placeholder type to represent "unbridged"John McCall2011-10-171-0/+5
| | | | | | | | casts in ARC. No semantic analysis yet. llvm-svn: 142208
* For modules, all macros that aren't include guards are implicitlyDouglas Gregor2011-10-171-2/+3
| | | | | | | public. Add a __private_macro__ directive to hide a macro, similar to the __module_private__ declaration specifier. llvm-svn: 142188
* Provide half floating point support as a storage only type.Anton Korobeynikov2011-10-141-0/+1
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman2011-10-061-0/+14
| | | | | | | | committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic. Thanks to Jeffrey Yasskin for the thorough review! llvm-svn: 141330
* Add a comment in ASTReader::ReadPragmaDiagnosticMappings that the user bitArgyrios Kyrtzidis2011-09-261-0/+1
| | | | | | is set by the setDiagnosticMapping call. llvm-svn: 140578
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-2/+2
| | | | llvm-svn: 140478
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-2/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Do manual binary search for preprocessing entities because their end locationsArgyrios Kyrtzidis2011-09-221-3/+22
| | | | | | may be unordered and MSVC's debug-mode doesn't like it. llvm-svn: 140337
* Fix MSVC9 build by providing a full comparator object to lower_bound.Benjamin Kramer2011-09-211-2/+8
| | | | llvm-svn: 140238
* [PCH] Don't store the source range for each preprocessed entity sinceArgyrios Kyrtzidis2011-09-201-19/+15
| | | | | | we already have the range in the PPEntityOffsets array. llvm-svn: 140209
* [PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntityArgyrios Kyrtzidis2011-09-201-93/+94
| | | | | | and don't store the ID for each preprocessed entity. llvm-svn: 140208
* The location of the name in MacroDefinition is the beginning of its range,Argyrios Kyrtzidis2011-09-201-1/+0
| | | | | | don't store an extra location for it. llvm-svn: 140190
* In libclang, when visiting preprocessed entities in a source range, useArgyrios Kyrtzidis2011-09-191-10/+0
| | | | | | | | | | PreprocessingRecord's getPreprocessedEntitiesInRange. Also remove all the stuff that were added in ASTUnit that are unnecessary now that we do a binary search for preprocessed entities and deserialize only what is necessary. llvm-svn: 140063
* [libclang] When getting a source location from a file:line:col tripletArgyrios Kyrtzidis2011-09-191-13/+5
| | | | | | | check whether the requested location points inside the precompiled preamble, in which case the returned source location will be a "loaded" one. llvm-svn: 140060
* Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()Argyrios Kyrtzidis2011-09-191-5/+130
| | | | | | | | | | which will do a binary search and return a pair of iterators for preprocessed entities in the given source range. Source ranges of preprocessed entities are stored twice currently in the PCH/Module file but this will be fixed in a subsequent commit. llvm-svn: 140058
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-2/+2
| | | | | | It already works (and is useful with) macro locs as well. llvm-svn: 140057
* Const-ify some methods in ASTReader.Argyrios Kyrtzidis2011-09-191-2/+2
| | | | llvm-svn: 140054
* [PCH] Preload the PreloadSLocEntries through the SourceManager andArgyrios Kyrtzidis2011-09-191-3/+5
| | | | | | | | don't call ReadSLocEntryRecord() directly because the entry may have already been loaded in which case calling ReadSLocEntryRecord() directly would trigger an assertion in SourceManager. llvm-svn: 140052
* When we load the first module, make sure that we wire up the ASTConsumer to ↵Douglas Gregor2011-09-151-0/+1
| | | | | | the newly-created ASTReader. This makes sure that CodeGen sees the declarations it is interested in llvm-svn: 139824
* [PCH] Overhaul how preprocessed entities are [de]serialized.Argyrios Kyrtzidis2011-09-151-135/+45
| | | | | | | | | | | | | -Use an array of offsets for all preprocessed entities -Get rid of the separate array of offsets for just macro definitions; for references to macro definitions use an index inside the preprocessed entities array. -Deserialize each preprocessed entity lazily, at first request; not in bulk. Paves the way for binary searching of preprocessed entities that will offer efficiency and will simplify things on the libclang side a lot. llvm-svn: 139809
* [PCH] Fix a regression that r139441 introduced (decls were getting passedArgyrios Kyrtzidis2011-09-131-2/+21
| | | | | | | | | | | | | | | | | to the consumer without being fully deserialized). The regression was on compiling boost.python and it was too difficult to get a reduced test case unfortunately. Also modify the logic of how objc methods are getting passed to the consumer; codegen depended on receiving objc methods before the implementation decl. Since the interesting objc methods are ones with a body and such methods only exist inside an ObjCImplDecl, deserialize and pass to consumer all the methods of ObCImplDecl when we see one. Fixes http://llvm.org/PR10922 & rdar://10117105. llvm-svn: 139644
* Switch the serialization of LangOptions over to use the .def file. WeDouglas Gregor2011-09-131-164/+30
| | | | | | | should no longer have the serialization of LangOptions out of sync with the structure itself (yay). llvm-svn: 139613
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-6/+6
| | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
* [libclang] In ASTUnit::Parse copy the CompilerInvocation object instead ofArgyrios Kyrtzidis2011-09-121-1/+5
| | | | | | | | | | | | modifying directly for the preamble. This avoids an awful, hard to find, bug where "PreprocessorOpts.DisablePCHValidation = true" would be persistent for subsequent reparses of the translation unit which would result in defines, present in command-line but not in the PCH, being ignored. Fixes rdar://9615399. llvm-svn: 139512
OpenPOWER on IntegriCloud