summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* [PCH] Make sure that the SourceExpr of a OpaqueValueExpr is always initializedArgyrios Kyrtzidis2011-12-032-27/+4
| | | | | | | | | | when deserialized, fixing random crashes in libclang. Also simplifies how OpaqueValueExprs are [de]serialized. The reader/writer automatically retains pointer equality of sub-statements (when a statement node is referenced in multiple nodes), so no need to manually handle it. llvm-svn: 145752
* Module files representing actual modules don't need to know the set of ↵Douglas Gregor2011-12-031-19/+20
| | | | | | modules they import, since that information isn't actually used. Drop it from the AST file llvm-svn: 145738
* Implement support for precompiled headers, preambles, and serializedDouglas Gregor2011-12-032-0/+42
| | | | | | | | "main" files that import modules. When loading any of these kinds of AST files, we make the modules that were imported visible into the translation unit that loaded the PCH file or preamble. llvm-svn: 145737
* Introduce a module import declaration, so that we properly represent, e.g.,Douglas Gregor2011-12-022-0/+39
| | | | | | | | __import_module__ std.vector; in the AST. llvm-svn: 145725
* Only perform checking of the predefines buffer when loading aDouglas Gregor2011-12-021-2/+2
| | | | | | | | | | | | | precompiled header. Previously, we were trying to gather predefines buffers from all kinds of AST files (which doesn't make sense) and were performing some validation when AST files were loaded as main files. With these tweaks, using PCH files that import modules no longer fails immediately (due to mismatched predefines buffers). However, module visibility is lost, so this feature does not yet work. llvm-svn: 145709
* When making a module visible, also make any of its exported modulesDouglas Gregor2011-12-021-0/+12
| | | | | | | visible, allowing one to create modules that import (and then re-export) other modules. llvm-svn: 145696
* Implement (de-)serialization of the set of exported modules in aDouglas Gregor2011-12-022-1/+51
| | | | | | module map. llvm-svn: 145695
* Notify the AST writer (via ASTDeserializationListener) when aDouglas Gregor2011-12-022-0/+11
| | | | | | | (sub)module is read from an AST file. This makes sure that the AST writer knows how to map all modules to their global IDs. llvm-svn: 145685
* Implement name hiding for macro definitions within modules, such thatDouglas Gregor2011-12-022-11/+40
| | | | | | | | only the macro definitions from visible (sub)modules will actually be visible. This provides the same behavior for macros that r145640 provided for declarations. llvm-svn: 145683
* Implement name hiding for declarations deserialized from a non-visibleDouglas Gregor2011-12-013-5/+51
| | | | | | module. When that module becomes visible, so do those declarations. llvm-svn: 145640
* Introduce the notion of name visibility into modules. For a givenDouglas Gregor2011-12-011-0/+32
| | | | | | | | | | | | | | (sub)module, all of the names may be hidden, just the macro names may be exposed (for example, after the preprocessor has seen the import of the module but the parser has not), or all of the names may be exposed. Importing a module makes its names, and the names in any of its non-explicit submodules, visible to name lookup (transitively). This commit only introduces the notion of name visible and marks modules and submodules as visible when they are imported. The actual name-hiding logic in the AST reader will follow (along with test cases). llvm-svn: 145586
* Infer the submodule ID for a given declaration based on the locationDouglas Gregor2011-12-013-4/+52
| | | | | | | of that declaration, and encode the submodule ID in each declaration stored in an AST file. llvm-svn: 145555
* Switch the ID numbers used for submodule IDs in the AST reader over toDouglas Gregor2011-12-013-16/+120
| | | | | | | | 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-308-143/+143
| | | | | | | | | 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-302-1/+208
| | | | | | | | | 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
* When writing a module file, pass the module through to the ASTDouglas Gregor2011-11-303-10/+11
| | | | | | writer. No functionality change. llvm-svn: 145479
* [PCH] Check for isTopLevelDeclInObjCContainer when picking abbreviations.Argyrios Kyrtzidis2011-11-231-0/+5
| | | | llvm-svn: 145110
* [libclang] Fix operations (token annotation, getting cursor, etc.) with a ↵Argyrios Kyrtzidis2011-11-233-0/+17
| | | | | | | | | | | | | | | 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-162-17/+54
| | | | | | | | | | 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-152-0/+7
| | | | | | building modules. llvm-svn: 144680
* [PCH] When serializing an PseudoObjectExpr or AtomicExpr, the serialization ↵Argyrios Kyrtzidis2011-11-151-0/+4
| | | | | | | | code must be set otherwise it will crash with asserts on or it will be written as null pointer. llvm-svn: 144626
* Use Decl's isImplicit field to indicate whether an ObjCInterfaceDecl is ↵Argyrios Kyrtzidis2011-11-152-2/+0
| | | | | | | | 'ImplicitInterfaceDecl', no need to store it in another field. llvm-svn: 144624
* [PCH] Load the chained objc categories only after recursive loading is finishedArgyrios Kyrtzidis2011-11-142-2/+12
| | | | | | otherwise we may crash. llvm-svn: 144524
* [PCH] Do not crash if a class extension in a chained PCH ↵Argyrios Kyrtzidis2011-11-141-0/+14
| | | | | | introduces/redeclares a property. llvm-svn: 144520
* [PCH] In ASTWriter::WriteChainedObjCCategories use getDeclID since the declsArgyrios Kyrtzidis2011-11-141-6/+5
| | | | | | should have been already emitted. llvm-svn: 144519
* [PCH] When chaining a PCH and serializing HeaderSearch, make sure the ↵Argyrios Kyrtzidis2011-11-131-4/+6
| | | | | | | | | HeaderFileInfos from the primary PCH is deserialized, otherwise we lose info that headers were already #imported/#included. llvm-svn: 144510
* Fix the signature of the getcontext builtin. Patch by Dimitry Andric.Rafael Espindola2011-11-132-0/+19
| | | | llvm-svn: 144505
* Add a method in ASTMutationListener for the last use of Decl's ↵Argyrios Kyrtzidis2011-11-121-8/+8
| | | | | | | | [is/set]ChangedSinceDeserialization and remove them. llvm-svn: 144466
* [PCH] When completing an objc forward reference, do not serialize the chain ↵Argyrios Kyrtzidis2011-11-122-18/+17
| | | | | | | | | | | | | | | of its categories because it is going to be rewritten (and the chain will be serialized again), otherwise we may form a cycle in its categories list when deserializing. Also introduce ASTMutationListener::CompletedObjCForwardRef to notify that a forward reference was completed; using Decl's isChangedSinceDeserialization/setChangedSinceDeserialization is bug inducing and kinda gross, we should phase it out. Fixes infinite loop in rdar://10418538. llvm-svn: 144465
* 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
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-102-11/+12
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* [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
* Change the AST representation of operations on Objective-CJohn McCall2011-11-062-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* [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
* Fix the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman2011-11-012-4/+5
| | | | | | | | | | native representation of integers for the elements. This fixes a bunch of nastiness involving treating wide strings as a series of bytes. Patch by Seth Cantrell. llvm-svn: 143417
* Rework the AST for the initializer of a delegating constructor, soDouglas Gregor2011-11-012-12/+11
| | | | | | | | | 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-314-9/+13
| | | | | | 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] Sort the file decls by file offset not raw source location.Argyrios Kyrtzidis2011-10-281-4/+5
| | | | | | | Currently sorting by raw source location does work as intended but who knows what may change in the future.. llvm-svn: 143256
* [PCH] In ASTWriter::associateDeclWithFile don't bother finding the file locArgyrios Kyrtzidis2011-10-282-8/+9
| | | | | | if we are not interested in the decl. llvm-svn: 143255
* [PCH] Keep track of file-level declarations that are contained by files.Argyrios Kyrtzidis2011-10-284-46/+149
| | | | | | | | | | | | 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-273-19/+19
| | | | | | | | | | | 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-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
OpenPOWER on IntegriCloud