summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-132-8/+8
| | | | | | | | | | 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
* Keep the source range of attributes. Depends on a llvm tablegen commit.Argyrios Kyrtzidis2011-09-132-2/+2
| | | | llvm-svn: 139600
* [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
* remove pedantic ;Chris Lattner2011-09-101-1/+1
| | | | llvm-svn: 139472
* Don't crash when we fail to load a module. It's unbecoming of aDouglas Gregor2011-09-101-77/+79
| | | | | | well-bred compiler like Clang. llvm-svn: 139442
* Clean up our handling of Objective-C definitions in AST files. RatherDouglas Gregor2011-09-102-6/+17
| | | | | | | | | than having CodeGen check whether a declaration comes from an AST file (which it shouldn't know or care about), make sure that the AST writer and reader pass along "interesting" declarations that CodeGen needs to know about. llvm-svn: 139441
* Kill of the Decl::PCHLevel field entirely. We now only need to knowDouglas Gregor2011-09-102-16/+1
| | | | | | whether a Decl was deserialized from an AST file (any AST file). llvm-svn: 139438
* Eliminate all but one caller of Decl::getPCHLevel()Douglas Gregor2011-09-092-4/+2
| | | | llvm-svn: 139430
* Introduce a new predicate Decl::isFromASTFile() to determine whether aDouglas Gregor2011-09-092-24/+24
| | | | | | | | declaration was deserialized from an AST file. Use this instead of Decl::getPCHLevel() wherever possible. This is a simple step toward killing off Decl::getPCHLevel(). llvm-svn: 139427
* In the ASTReader, replace the never-NULL Preprocessor pointer with aDouglas Gregor2011-09-091-85/+59
| | | | | | | Preprocessor reference. Simplify some code along the way, so there is no separate "initialize the preprocessor" step. llvm-svn: 139418
* In ASTReader, replace the never-NULL ASTContext pointer with anDouglas Gregor2011-09-093-328/+294
| | | | | | | | ASTContext reference. Remove all of the extra checking and logic that was used to cope with a NULL ASTContext. No effective functionality change. llvm-svn: 139413
* Mark the translation unit as having lexical/visible storage only when we ↵Douglas Gregor2011-09-091-4/+5
| | | | | | actually have data for that lexical or visible storage llvm-svn: 139409
* Back out r139358 "[PCH] When loading the decls linked to anDouglas Gregor2011-09-091-8/+0
| | | | | | | | identifier, also make them visible in the translation unit," which isn't needed now that John's eliminated the AST dependency in blocks CodeGen. llvm-svn: 139408
* [PCH] When loading the decls linked to an identifier, also make them visibleArgyrios Kyrtzidis2011-09-091-0/+8
| | | | | | in the translation unit. llvm-svn: 139358
* Modules: introduce the __module_private__ declaration specifier, whichDouglas Gregor2011-09-092-0/+16
| | | | | | | indicates that a declaration is only visible within the module it is declared in. llvm-svn: 139348
* [libclang] Fix annotation and getting a "macro expansion" cursorArgyrios Kyrtzidis2011-09-082-6/+14
| | | | | | for a builtin macro expansion. llvm-svn: 139298
* Implement the Objective-C 'instancetype' type, which is an alias ofDouglas Gregor2011-09-082-0/+6
| | | | | | | | | | 'id' that can be used (only!) via a contextual keyword as the result type of an Objective-C message send. 'instancetype' then gives the method a related result type, which we have already been inferring for a variety of methods (new, alloc, init, self, retain). Addresses <rdar://problem/9267640>. llvm-svn: 139275
* Finish implementing (de-)serialization of the CXXDefinitionData bitsDouglas Gregor2011-09-062-0/+8
| | | | | | | needed for implicit move constructors and move assignment operators. Fixes PR10847. llvm-svn: 139144
* Always construct an ASTReader with a non-NULL ASTContext andDouglas Gregor2011-09-022-23/+3
| | | | | | | | | Preprocessor, eliminating the constructor that was used by ASTUnit (which didn't provide an ASTContext or Prepreprocessor). Ensuring that both objects are non-NULL will simplify module loading (but none of that is done yet). llvm-svn: 138986
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Don't try keeping a 'LeadingEmptyMacroLoc' in NullStmt. This failsArgyrios Kyrtzidis2011-09-012-2/+2
| | | | | | in the face of buffering C++/ObjC method bodies. llvm-svn: 138972
* Modules hide macro definitions by default, so that silly things likeDouglas Gregor2011-09-014-40/+62
| | | | | | | | | | | include guards don't show up as macro definitions in every translation unit that imports a module. Macro definitions can, however, be exported with the intentionally-ugly #__export_macro__ directive. Implement this feature by not even bothering to serialize non-exported macros to a module, because clients of that module need not (should not) know that these macros even exist. llvm-svn: 138943
* Fix "multi-line comment" compiler error.Argyrios Kyrtzidis2011-09-011-8/+8
| | | | llvm-svn: 138936
* Support importing of ObjC categories from modules.Argyrios Kyrtzidis2011-09-013-0/+189
| | | | | | | | | | | | The initial incentive was to fix a crash when PCH chaining categories to an interface, but the fix was done in the "modules way" that I hear is popular with the kids these days. Each module stores the local chain of categories and we combine them when the interface is loaded. We also warn if non-dependent modules introduce duplicate named categories. llvm-svn: 138926
* Serialize the new bits in CXXRecordDecl::DefinitionData.Sebastian Redl2011-08-312-4/+8
| | | | llvm-svn: 138855
* When writing out the entries in a lookup table for a DeclContext, makeDouglas Gregor2011-08-301-1/+24
| | | | | | | | sure that all of the CXXConversionDecls go into the same bucket. Otherwise, name lookup might not find them all. Fixes <rdar://problem/10041960>. llvm-svn: 138824
* Remove a few mutating ObjCCategoryDecl methods.Argyrios Kyrtzidis2011-08-301-4/+3
| | | | | | | | | | | Remove -setClassInterface -setNextClassCategory -insertNextClassCategory and combine them in the Create function. llvm-svn: 138817
* In ASTWriter::WriteDeclContextVisibleBlock, don't write empty lookups.Argyrios Kyrtzidis2011-08-301-2/+4
| | | | | | | Empty lookups can occur in the DeclContext map when we are chaining PCHs, where the empty lookup indicates that we already looked in ExternalASTSource. llvm-svn: 138816
* Remove obsolete ObjCInferRelatedReturnType from LangOptions...the correct ↵Jordy Rose2011-08-302-3/+0
| | | | | | option is ObjCInferRelatedResultType. llvm-svn: 138793
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-272-24/+13
| | | | | | | | | | , such as list of forward @class decls, in a DeclGroup node. Deal with its consequence throught clang. This is in preparation for more Sema work ahead. // rdar://8843851. Feel free to reverse if it breaks something important and I am unavailable. llvm-svn: 138709
* Remove unused variables noticed by GCC.Benjamin Kramer2011-08-271-5/+0
| | | | llvm-svn: 138707
* Teach the ASTReader how to avoid cycles when loading declarations thatDouglas Gregor2011-08-261-5/+7
| | | | | | are lexically within a particular DeclContext. Test forthcoming. llvm-svn: 138668
* Remove the Chaining argument from the PCH/module generator. It's no longer usedDouglas Gregor2011-08-252-10/+3
| | | | llvm-svn: 138596
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-252-2/+2
| | | | | | | | | from the given source. -emit-module behaves similarly to -emit-pch, except that Sema is somewhat more strict about the contents of -emit-module. In the future, there are likely to be more interesting differences. llvm-svn: 138595
* Clean up the reloading of identifier information following the load ofDouglas Gregor2011-08-251-58/+41
| | | | | | | a top-level module. This code is still horrible and should go away, but we're not there yet. llvm-svn: 138586
* Preload source location entries as soon as we've loaded a particularDouglas Gregor2011-08-251-11/+15
| | | | | | | AST file, rather than waiting until we finish loading the top-level AST file. llvm-svn: 138585
* Move file validation in the ASTReader from "top of chain" validationDouglas Gregor2011-08-251-65/+63
| | | | | | | to "when loading a particular module" validation, since it was only validating local information anyway. This shouldn't change anything. llvm-svn: 138583
* Factor the Module and ModuleManager classes out into separate headersDouglas Gregor2011-08-255-762/+890
| | | | | | | and .cpp files, since ASTReader.cpp was getting way too large. No functionality change. llvm-svn: 138582
* Switch ASTReader::GetHeaderFileInfo() from a walk over the moduleDouglas Gregor2011-08-251-20/+43
| | | | | | chain to a proper search. llvm-svn: 138574
* Switch the forward walk through the module chain over to a depth-firstDouglas Gregor2011-08-251-9/+30
| | | | | | search in ASTReader::ReadPreprocessedEntities(). llvm-svn: 138572
* Remove a bogus assertion from the AST reader, which assumed thatDouglas Gregor2011-08-251-12/+6
| | | | | | | | | | redeclarations of a particular entity would occur in source order. Friend declarations that occur within class templates (or member classes thereof) do not follow this, nor would modules. Big thanks to Erik Verbruggen for reducing this problem from the Very Large Qt preamble testcase he found. llvm-svn: 138557
* Use the module manager's search facility to look for methods with aDouglas Gregor2011-08-251-47/+88
| | | | | | | | | given selector, rather than walking the chain backwards. Teach its visitor how to merge multiple result sets into a single result set, combining the results of selector lookup in several different modules into a single result set. llvm-svn: 138556
* Don't force the complete deserialization of the visible-declarationsDouglas Gregor2011-08-243-46/+1
| | | | | | | | | | table when serializing an AST file. This was a holdover from the days before chained PCH, and is a complete waste of time and storage now. It's a good thing it's useless, because I have no idea how I would have implemented MaterializeVisibleDecls efficiently in the presence of modules. llvm-svn: 138496
* Introduce a depth-first search of modules into the module manager,Douglas Gregor2011-08-241-24/+97
| | | | | | | | | | | | which supports both pre-order and post-order traversal via a visitor mechanism. Use this depth-first search with a post-order traversal to give predictable ordering semantics when walking all of the lexical declarations in the translation unit. Eventually, module imports will occur in the source code rather than at the beginning, and we'll have to revisit this walk. llvm-svn: 138490
* In the AST reader, switch name lookup within a DeclContect over to theDouglas Gregor2011-08-242-119/+126
| | | | | | | | | | | | | | | | | | module DAG-based lookup scheme. This required some reshuffling, so that each module stores its own mapping from DeclContexts to their lexical and visible sets for those DeclContexts (rather than one big "chain"). Overall, this allows simple qualified name lookup into the translation unit to gather results from multiple modules, with the lookup results in module B shadowing the lookup results in module A when B imports A. Walking all of the lexical declarations in a module DAG is still a mess; we'll end up walking the loaded module list backwards, which works fine for chained PCH but doesn't make sense in a DAG. I'll tackle this issue as a separate commit. llvm-svn: 138463
* Boost the efficiency of SourceManager::getMacroArgExpandedLocation.Argyrios Kyrtzidis2011-08-212-2/+7
| | | | | | | | | | | | | | | | | | 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
* Make the loading of multiple records for the same identifier (fromDouglas Gregor2011-08-201-1/+3
| | | | | | | | | | different modules) more robust. It already handled (simple) merges of the set of declarations attached to that identifier, so add a test case that shows us getting two different declarations for the same identifier (one struct, one function) from different modules, and are able to use both of them. llvm-svn: 138189
* Clean out some minor cruft in the AST reader; no functionality change.Douglas Gregor2011-08-201-2/+0
| | | | llvm-svn: 138188
* Introduce a module visitation function that starts at the top-levelDouglas Gregor2011-08-201-19/+116
| | | | | | | | | | | | | | | | | modules (those that no other module depends on) and performs a search over all of the modules, visiting a new module only when all of the modules that depend on it have already been visited. The visitor can abort the search for all modules that a module depends on, which allows us to minimize the number of lookups necessary when performing a search. Switch identifier lookup from a linear walk over the set of modules to this module visitation operation. The behavior is the same for simple PCH and chained PCH, but provides the proper search order for modules. Verified with printf debugging, since we don't have enough in place to actually test this. llvm-svn: 138187
* Remove unused function ModuleManager::exportLookup()Douglas Gregor2011-08-191-10/+0
| | | | llvm-svn: 138079
OpenPOWER on IntegriCloud