summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix CastingDavid Greene2013-01-151-1/+1
| | | | | | Make the const_cast explicit to silence a compiler warning. llvm-svn: 172560
* Implement parsing, AST, (de-)serialization, and placeholder globalDouglas Gregor2013-01-141-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | metadata for linking against the libraries/frameworks for imported modules. The module map language is extended with a new "link" directive that specifies what library or framework to link against when a module is imported, e.g., link "clangAST" or link framework "MyFramework" Importing the corresponding module (or any of its submodules) will eventually link against the named library/framework. For now, I've added some placeholder global metadata that encodes the imported libraries/frameworks, so that we can test that this information gets through to the IR. The format of the data is still under discussion. llvm-svn: 172437
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-3/+3
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Truth in advertising: LocallyScopedExternalDecls actually only containsRichard Smith2013-01-101-10/+10
| | | | | | external declarations with C language linkage. llvm-svn: 172150
* [PCH] (De)serialize the end location of MacroInfo.Argyrios Kyrtzidis2013-01-071-0/+1
| | | | llvm-svn: 171772
* updateOutOfDateIdentifier() can cause the identifier table to beDouglas Gregor2013-01-071-2/+10
| | | | | | | | rehashed, invaliding the iterator walking through the identifier table. Separate out the identification of out-of-date identifiers from updating them. llvm-svn: 171756
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-7/+8
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* [PCH] Make the new PCH format (control block) backwards compatible andArgyrios Kyrtzidis2012-12-131-0/+6
| | | | | | | | | | | | don't crash when loading a PCH with the older format. The introduction of the control block broke compatibility with PCHs from older versions. This patch allows loading (and rejecting) PCHs from an older version and allows newer PCHs to be rejected from older clang versions as well. rdar://12821386 llvm-svn: 170150
* [PCH] When writing out the list of input files, avoid emitting duplicateArgyrios Kyrtzidis2012-12-111-1/+6
| | | | | | | | | entries of the same file. This can happen because the file was "included" multiple times and is referenced by multiple SLocEntries. llvm-svn: 169829
* Finish implementing 'selected constructor' rules for triviality in C++11. InRichard Smith2012-12-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | the cases where we can't determine whether special members would be trivial while building the class, we eagerly declare those special members. The impact of this is bounded, since it does not trigger implicit declarations of special members in classes which merely *use* those classes. In order to determine whether we need to apply this rule, we also need to eagerly declare move operations and destructors in cases where they might be deleted. If a move operation were supposed to be deleted, it would instead be suppressed, and we could need overload resolution to determine if we fall back to a trivial copy operation. If a destructor were implicitly deleted, it would cause the move constructor of any derived classes to be suppressed. As discussed on cxx-abi-dev, C++11's selected constructor rules are also retroactively applied as a defect resolution in C++03 mode, in order to identify that class B has a non-trivial copy constructor (since it calls A's constructor template, not A's copy constructor): struct A { template<typename T> A(T &); }; struct B { mutable A a; }; llvm-svn: 169673
* Implement C++03 [dcl.init]p5's checking for value-initialization of referencesRichard Smith2012-12-081-0/+1
| | | | | | | | properly, rather than faking it up by pretending that a reference member makes the default constructor non-trivial. That leads to rejects-valids when putting such types inside unions. llvm-svn: 169662
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-10/+10
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Refactor to reduce duplication in handling of special member functions. No ↵Richard Smith2012-11-301-18/+4
| | | | | | functionality change. llvm-svn: 168977
* Store on the CXXRecordDecl whether the class has, or would have, a copyRichard Smith2012-11-281-0/+4
| | | | | | | constructor/assignment operator with a const-qualified parameter type. The prior method for determining this incorrectly used overload resolution. llvm-svn: 168775
* Introduce ASTUnresolvedSet, an UnresolvedSet-like class, whose contents areArgyrios Kyrtzidis2012-11-281-2/+2
| | | | | | | | | | | allocated using the allocator associated with an ASTContext. Use this inside CXXRecordDecl::DefinitionData instead of an UnresolvedSet to avoid a potential memory leak. rdar://12761275 llvm-svn: 168771
* [modules] Use a memory buffer directly as input for the module includes,Argyrios Kyrtzidis2012-11-151-0/+5
| | | | | | instead of messing with virtual files. llvm-svn: 168062
* [modules] Setup the import location of a module file and use itArgyrios Kyrtzidis2012-11-151-1/+1
| | | | | | as the include location of the main file of an imported module. llvm-svn: 168061
* Suppress elided variadic macro argument extension diagnostic for macros usingEli Friedman2012-11-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | the related comma pasting extension. In certain cases, we used to get two diagnostics for what is essentially one extension. This change suppresses the first diagnostic in certain cases where we know we're going to print the second diagnostic. The diagnostic is redundant, and it can't be suppressed in the definition of the macro because it points at the use of the macro, so we want to avoid printing it if possible. The implementation works by detecting constructs which look like comma pasting at the time of the definition of the macro; this information is then used when the macro is used. (We can't actually detect whether we're using the comma pasting extension until the macro is actually used, but we can detecting constructs which will be comma pasting if the varargs argument is elided.) <rdar://problem/12292192> llvm-svn: 167907
* [PCH] Remove the stat cache from the PCH file.Argyrios Kyrtzidis2012-10-311-46/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stat cache became essentially useless ever since we started validating all file entries in the PCH. But the motivating reason for removing it now is that it also affected correctness in this situation: -You have a header without include guards (using "#pragma once" or #import) -When creating the PCH: -The same header is referenced in an #include with different filename cases. -In the PCH, of course, we record only one file entry for the header file -But we cache in the PCH file the stat info for both filename cases -Then the source files are updated and the header file is updated in a way that its size and modification time are the same but its inode changes -When using the PCH: -We validate the headers, we check that header file and we create a file entry with its current inode -There's another #include with a filename with different case than the previously created file entry -In order to get its stat info we go through the cached stat info of the PCH and we receive the old inode -because of the different inodes, we think they are different files so we go ahead and include its contents. Removing the stat cache will potentially break clients that are attempting to use the stat cache as a way of avoiding having the actual input files available. If that use case is important, patches are welcome to bring it back in a way that will actually work correctly (i.e., emit a PCH that is self-contained, coping with literal strings, line/column computations, etc.). This fixes rdar://5502805 llvm-svn: 167172
* [PCH] The diagnostic state points can refer to previously createdArgyrios Kyrtzidis2012-10-301-8/+19
| | | | | | | | | diagnostic states; make sure the ASTReader sets the diagnostic state properly instead of always recreating it. Fixes rdar://12581618 & http://llvm.org/PR14181 llvm-svn: 166987
* Teach the PCH validator to check the preprocessor options, especiallyDouglas Gregor2012-10-241-0/+1
| | | | | | | | | | | | | | | the macros that are #define'd or #undef'd on the command line. This checking happens much earlier than the current macro-definition checking and is far cleaner, because it does a direct comparison rather than a diff of the predefines buffers. Moreover, it allows us to use the result of this check to skip over PCH files within a directory that have non-matching -D's or -U's on the command line. Finally, it improves the diagnostics a bit for mismatches, fixing <rdar://problem/8612222>. The old predefines-buffer diff'ing will go away in a subsequent commit. llvm-svn: 166641
* (De-)serialize the preprocessor options, including macros defined,Douglas Gregor2012-10-241-3/+30
| | | | | | -include'd files, etc. llvm-svn: 166614
* (De-)serialize header search options.Douglas Gregor2012-10-241-2/+40
| | | | llvm-svn: 166586
* (De-)serialize the file system options.Douglas Gregor2012-10-241-1/+9
| | | | llvm-svn: 166577
* Serialize DiagnosticOptions to the AST file.Douglas Gregor2012-10-241-0/+16
| | | | llvm-svn: 166572
* Eliminate the redundancy between source-file information in the sourceDouglas Gregor2012-10-221-26/+30
| | | | | | | | | | manager block and input-file information in the control block. The source manager entries now point back into the control block. Input files are now lazily deserialized (if validation is disabled). Reduces Cocoa's PCH by the ~70k I added when I introduced the redundancy in r166251. llvm-svn: 166429
* ASTWriter.cpp: Fix a warning. [-Wunused-variable]NAKAMURA Takumi2012-10-191-2/+1
| | | | llvm-svn: 166257
* Describe the new input-files block and its record, for llvm-bcanalyzer.Douglas Gregor2012-10-191-0/+3
| | | | llvm-svn: 166252
* Move the set of files to be validated in an AST file into the controlDouglas Gregor2012-10-191-17/+57
| | | | | | | | | | | | | block, so the input files are validated early on, before we've committed to loading the AST file. This (accidentally) fixed a but wherein the main file used to generate the AST file would *not* be validated by the existing validation logic. At the moment, this leads to some duplication of filenames between the source manager block and input-file blocks, as well as validation logic. This will be handled via an upcoming patch. llvm-svn: 166251
* Collapse the original file name and original file ID records into aDouglas Gregor2012-10-181-7/+5
| | | | | | single record. llvm-svn: 166206
* Collapse the "version control revision/tag" AST file record into theDouglas Gregor2012-10-181-22/+27
| | | | | | | metadata record, which already had other version information. Clean up the block info block along the way. llvm-svn: 166204
* Split the target options out into their own record within the ASTDouglas Gregor2012-10-181-13/+17
| | | | | | file's control block. llvm-svn: 166195
* Start factoring the on-disk records for an AST file into a controlDouglas Gregor2012-10-181-23/+27
| | | | | | | | | | | | | | | | | block, which stores information about how the AST file to generated, from the AST block, which stores the actual serialized AST. The information in the control block should be enough to determine whether the AST file is up-to-date and compatible with the current translation unit, and reading it should not cause any side effects that aren't easy to undo. That way, we can back out from an attempt to read an incompatible or out-of-date AST file. Note that there is still more factoring to do. In particular, information about the source files used to generate the AST file (along with their time stamps, sizes, etc.) still resides in the source manager block. llvm-svn: 166166
* Serialize TargetOptions into an AST file, and make sure that we keepDouglas Gregor2012-10-161-14/+16
| | | | | | | target options around so they can be accessed at any point (rather than keeping them transient). llvm-svn: 166072
* Introduce the notion of excluded headers into the module mapDouglas Gregor2012-10-151-0/+12
| | | | | | | | description. Previously, one could emulate this behavior by placing the header in an always-unavailable submodule, but Argyrios guilted me into expressing this idea properly. llvm-svn: 165921
* Track which particular submodule #undef's a macro, so that the actualDouglas Gregor2012-10-121-0/+1
| | | | | | #undef only occurs if that submodule is imported. llvm-svn: 165773
* [libclang] Improve AST serialization done by ASTUnit::Save().Argyrios Kyrtzidis2012-10-111-1/+1
| | | | | | | | | The ASTUnit needs to initialize an ASTWriter at the beginning of parsing to fully handle serialization of a translation unit that imports modules. Do this by introducing an option to enable it, which corresponds to CXTranslationUnit_ForSerialization on the C API side. llvm-svn: 165717
* Remove the ASTDeserializationListener's MacroVisible() callback, whichDouglas Gregor2012-10-111-16/+0
| | | | | | | is no longer necessary, as well as the little bit of infrastructure in the AST writer that used it. llvm-svn: 165684
* Remove an unused bit from the serialized IdentifierInfoDouglas Gregor2012-10-111-2/+0
| | | | llvm-svn: 165683
* Deserialize macro history when we deserialize an identifier that hasDouglas Gregor2012-10-111-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | macro history. When deserializing macro history, we arrange history such that the macros that have definitions (that haven't been #undef'd) and are visible come at the beginning of the list, which is what the preprocessor and other clients of Preprocessor::getMacroInfo() expect. If additional macro definitions become visible later, they'll be moved toward the front of the list. Note that it's possible to have ambiguities, but we don't diagnose them yet. There is a partially-implemented design decision here that, if a particular identifier has been defined or #undef'd within the translation unit, that definition (or #undef) hides any macro definitions that come from imported modules. There's still a little work to do to ensure that the right #undef'ing happens. Additionally, we'll need to scope the update records for #undefs, so they only kick in when the submodule containing that update record becomes visible. llvm-svn: 165682
* Rework the (de-)serialization of macros, as stored inDouglas Gregor2012-10-091-27/+100
| | | | | | | | | | | | | | | | MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. llvm-svn: 165560
* If a macro has been #undef'd in a precompiled header, we still need toDouglas Gregor2012-10-091-3/+2
| | | | | | | | | | | | write out the macro history for that macro. Similarly, we need to cope with reading a macro definition that has been #undef'd. Take advantage of this new ability so that global code-completion results can refer to #undef'd macros, rather than losing them entirely. For multiply defined/#undef'd macros, we will still get the wrong result, but it's better than getting no result. llvm-svn: 165502
* [Modules] Introduce Module::TopHeaders which is a set of top-level headersArgyrios Kyrtzidis2012-10-051-0/+11
| | | | | | that are associated with a (sub)module. llvm-svn: 165279
* Fixed FunctionTypeLoc source range.Abramo Bagnara2012-10-041-0/+2
| | | | llvm-svn: 165259
* [PCH/Module] Change the map of file-level DeclIDs to use a FileIDArgyrios Kyrtzidis2012-10-021-4/+5
| | | | | | | as key instead of a SLocEntry pointer. This allows the array of file sorted declarations in a PCH/module to be deterministic. llvm-svn: 165047
* [libclang] When indexing an AST file, only deserialize the file levelArgyrios Kyrtzidis2012-10-021-0/+2
| | | | | | declarations of the current primary module. llvm-svn: 165046
* Add info in the preprocessing record whether an inclusion directiveArgyrios Kyrtzidis2012-10-021-0/+2
| | | | | | resulted in an automatic module import. llvm-svn: 165022
* Fix the AST representation for non-type template arguments to encodeEli Friedman2012-09-261-0/+6
| | | | | | | | | | | | enough information so we can mangle them correctly in cases involving dependent parameter types. (This specifically impacts cases involving null pointers and cases involving parameters of reference type.) Fix the mangler to use this information instead of trying to scavenge it out of the parameter declaration. <rdar://problem/12296776>. llvm-svn: 164656
* Macro history (de-)serialization. Deserialization currently reads only the ↵Alexander Kornienko2012-09-251-89/+103
| | | | | | | | | | | | | | | | latest macro definition. Needs more work. Summary: Passes all tests (+ the new one with code completion), but needs a thorough review in part related to modules. Reviewers: doug.gregor Reviewed By: alexfh CC: cfe-commits, rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D41 llvm-svn: 164610
* ASTWriter: Tighten up assertions when emitting a declaration name.Benjamin Kramer2012-09-191-7/+9
| | | | | | | | clang has recently started to warn about the enum compares: lib/Serialization/ASTWriter.cpp:2760:31: warning: comparison of literal 256 with expression of type 'clang::DeclarationName::NameKind' is always true [-Wtautological-constant-out-of-range-compare] llvm-svn: 164220
OpenPOWER on IntegriCloud