summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
* Make the loading of information attached to an IdentifierInfo from anDouglas Gregor2011-10-272-93/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Eliminate a hang while loading a sequence of redeclarable entities. InDouglas Gregor2011-10-262-17/+38
| | | | | | | | | | | essence, the redeclaration chain for a class could end up in an inconsistent state while deserializing multiple declarations in that chain, where the circular linked list was not, in fact, circular. Since only two redeclarations of the same entity will get loaded when we're in this state, restore circularity when both have been loaded. Fixes <rdar://problem/10324940> / PR11195. llvm-svn: 143037
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-252-0/+2
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-252-2/+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-252-0/+2
| | | | | | | | | | | | | | | 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
* Implement support for dependent Microsoft __if_exists/__if_not_existsDouglas Gregor2011-10-252-0/+26
| | | | | | | | | | statements. As noted in the documentation for the AST node, the semantics of __if_exists/__if_not_exists are somewhat different from the way Visual C++ implements them, because our parsed-template representation can't accommodate VC++ semantics without serious contortions. Hopefully this implementation is "good enough". llvm-svn: 142901
* [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
* [PCH] When serializing Stmts, keep track of when sub statements are ↵Argyrios Kyrtzidis2011-10-212-4/+58
| | | | | | | | | | | | referenced again and in such a case just write out a reference of a previously serialized Stmt, instead of serializing it all over again. This saves memory + space + [de]serializing time, and avoids blowing up memory with pathological cases. rdar://10293911 llvm-svn: 142696
* Keep track when a ObjC interface/protocol was initially created as a forward ↵Argyrios Kyrtzidis2011-10-172-1/+5
| | | | | | reference. llvm-svn: 142230
* 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-172-0/+7
| | | | | | | | casts in ARC. No semantic analysis yet. llvm-svn: 142208
* For modules, all macros that aren't include guards are implicitlyDouglas Gregor2011-10-172-5/+7
| | | | | | | 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-142-0/+2
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* [PCH] Serialize info about redeclared objc methods.Argyrios Kyrtzidis2011-10-142-0/+15
| | | | llvm-svn: 141964
* Add support for viewing the module graph via Graphviz, for debuggingDouglas Gregor2011-10-111-0/+49
| | | | | | purposes. llvm-svn: 141697
* Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman2011-10-112-0/+38
| | | | llvm-svn: 141632
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-073-8/+8
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman2011-10-062-0/+26
| | | | | | | | 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
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-053-4/+17
| | | | llvm-svn: 141171
* Improve location fidelity of objc decls.Argyrios Kyrtzidis2011-10-042-10/+9
| | | | | | | | -Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl. -Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the class name, not the location of '@'. llvm-svn: 141061
* Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis2011-10-032-2/+17
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
* Allow getting all source locations of selector identifiers in a ObjCMessageExpr.Argyrios Kyrtzidis2011-10-032-3/+15
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: [foo first:1 second:2] -With a space between the arguments: [foo first: 1 second: 2] -For nullary selectors, immediately before ']': [foo release] In such cases we infer the locations instead of storing them. llvm-svn: 140987
* Pass from the parser the locations of selector identifiers when creatingArgyrios Kyrtzidis2011-10-031-0/+1
| | | | | | | | objc method decls. They are not stored in the AST yet. llvm-svn: 140984
* Don't keep NumSelectorArgs in the ObjCMethodDecl, the number can be derived ↵Argyrios Kyrtzidis2011-10-032-4/+1
| | | | | | from the selector. llvm-svn: 140983
* Mark a TagDecl when it is free standing (e.g. "struct foo;")Argyrios Kyrtzidis2011-09-302-0/+4
| | | | llvm-svn: 140894
* Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.Daniel Dunbar2011-09-291-1/+1
| | | | | | - Also, spell const_iterator as const_iterator. llvm-svn: 140765
* Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch toDaniel Dunbar2011-09-291-4/+3
| | | | | | | storing mappings with that instead of straying some magic constants about the source. llvm-svn: 140760
* 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-253-8/+8
| | | | llvm-svn: 140478
* Fix up assertion a bit moreDouglas Gregor2011-09-231-1/+1
| | | | llvm-svn: 140424
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-233-5/+0
| | | | llvm-svn: 140407
* Eliminate an MSVC comparison warning, from Aaron BallmanDouglas Gregor2011-09-231-1/+1
| | | | llvm-svn: 140388
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-235-11/+11
| | | | 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
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-222-9/+11
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no ↵Argyrios Kyrtzidis2011-09-222-7/+7
| | | | | | functionality change. llvm-svn: 140330
* ArrayRef-ifying Function/BlockDecl's setParamsDavid Blaikie2011-09-211-2/+2
| | | | llvm-svn: 140268
* 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-202-27/+15
| | | | | | we already have the range in the PPEntityOffsets array. llvm-svn: 140209
* [PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntityArgyrios Kyrtzidis2011-09-202-97/+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-202-2/+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-193-33/+1
| | | | | | | | | | 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
* Introduce local_begin()/local_end() methods in PreprocessingRecord whichArgyrios Kyrtzidis2011-09-191-3/+3
| | | | | | return iterators for local, non-loaded, preprocessed entities. llvm-svn: 140062
* [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-192-7/+133
| | | | | | | | | | 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
* With modules, we can end up loading a new module after we've seen anDouglas Gregor2011-09-171-7/+69
| | | | | | | | | arbitrary amount of code. This forces us to stage the AST writer more strictly, ensuring that we don't assign a declaration ID to a declaration until after we're certain that no more modules will get loaded. llvm-svn: 139974
* 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
OpenPOWER on IntegriCloud