summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Add the TypeSourceInfo for the lambda call operator to the lambda'sEli Friedman2012-09-191-0/+1
| | | | | | | | definition info; it needs to be there because the mangler needs to access it before we're finished defining the lambda class. PR12808. llvm-svn: 164186
* Keep history of macro definitions and #undefsAlexander Kornienko2012-08-291-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Summary: Keep history of macro definitions and #undefs with corresponding source locations, so that we can later find out all macros active in a specified source location. We don't save the history in PCH (no need currently). Memory overhead is about sizeof(void*)*3*<number of macro definitions and #undefs>+<in-memory size of all #undef'd macros> I've run a test on a file composed of 109 .h files from boost 1.49 on x86-64 linux. Stats before this patch: *** Preprocessor Stats: 73222 directives found: 19171 #define. 4345 #undef. #include/#include_next/#import: 5233 source files entered. 27 max include stack depth 19210 #if/#ifndef/#ifdef. 2384 #else/#elif. 6891 #endif. 408 #pragma. 14466 #if/#ifndef#ifdef regions skipped 80023/451669/1270 obj/fn/builtin macros expanded, 85724 on the fast path. 127145 token paste (##) operations performed, 11008 on the fast path. Preprocessor Memory: 5874615B total BumpPtr: 4399104 Macro Expanded Tokens: 417768 Predefines Buffer: 8135 Macros: 1048576 #pragma push_macro Info: 0 Poison Reasons: 1024 Comment Handlers: 8 Stats with this patch: ... Preprocessor Memory: 7541687B total BumpPtr: 6066176 Macro Expanded Tokens: 417768 Predefines Buffer: 8135 Macros: 1048576 #pragma push_macro Info: 0 Poison Reasons: 1024 Comment Handlers: 8 In my test increase in memory usage is about 1.7Mb, which is ~28% of initial preprocessor's memory usage and about 0.8% of clang's total VMM allocation. As for CPU overhead, it should only be noticeable when iterating over all macros, and should mostly consist of couple extra dereferences and one comparison per macro + skipping of #undef'd macros. It's less trivial to measure, though, as the preprocessor consumes a very small fraction of compilation time. Reviewers: doug.gregor, klimek, rsmith, djasper Reviewed By: doug.gregor CC: cfe-commits, chandlerc Differential Revision: http://llvm-reviews.chandlerc.com/D28 llvm-svn: 162810
* [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.Chad Rosier2012-08-251-1/+1
| | | | | | No functional change intended. llvm-svn: 162632
* [ms-inline asm] Update the AST Reader/Writer for MS-style inline asms.Chad Rosier2012-08-241-0/+1
| | | | llvm-svn: 162629
* Fix a few -Wdocumentation warnings.Dmitri Gribenko2012-08-241-2/+0
| | | | llvm-svn: 162506
* Remove trailing return flag from FunctionTypeLoc, since we now carry thatRichard Smith2012-08-141-1/+0
| | | | | | | information on FunctionProtoType. (This also fixes one of *many* misalignment problems in the TypeLoc hierarchy...) llvm-svn: 161901
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* Inline storage of attributes in AttributedStmt.Alexander Kornienko2012-07-091-3/+5
| | | | llvm-svn: 159925
* Don't store pointers into a std::vector (RawCommentList::Comments). AlthoughDmitri Gribenko2012-07-061-7/+7
| | | | | | | | currently we take address of std::vector's contents only after we finished adding all comments (so no reallocation can happen), this will change in future. llvm-svn: 159845
* [PCH] Make sure that all newly introduced visible decls in a DeclContextArgyrios Kyrtzidis2012-07-021-2/+24
| | | | | | | | | | | | | | | | | coming from an AST file are registered for serialization. A static data member instantiation of in a chained PCH could be missed when serializing decls; the result was that when emitting the visible decls map of its DeclContext, we would use a DeclID that was not actually emitted, leading to crashes or hangs. Fix this by making sure such decls are always registered for serialization. Also introduce extra sanity checks to make sure we don't register new declarations or types after we have serialized the types/decls block. rdar://11728990 llvm-svn: 159550
* Restructure how the driver communicates information about theJohn McCall2012-06-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Structured comment parsing, first step.Dmitri Gribenko2012-06-201-0/+18
| | | | | | | | | * Retain comments in the AST * Serialize/deserialize comments * Find comments attached to a certain Decl * Expose raw comment text and SourceRange via libclang llvm-svn: 158771
* Explicitly build __builtin_va_list.Meador Inge2012-06-161-2/+3
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* Remove CXXRecordDecl flags which are unused after r158289.Richard Smith2012-06-101-4/+0
| | | | | | | | | | | | | | | | | | | | | We need an efficient mechanism to determine whether a defaulted default constructor is constexpr, in order to determine whether a class is a literal type, so keep the incrementally-built form on CXXRecordDecl. Remove the on-demand computation of same, so that we only have one method for determining whether a default constructor is constexpr. This doesn't affect correctness, since default constructor lookup is much simpler than selecting a constructor for copying or moving. We don't need a corresponding mechanism for defaulted copy or move constructors, since they can't affect whether a type is a literal type. Conversely, checking whether such functions are constexpr can require non-trivial effort, so we defer such checks until the copy or move constructor is required. Thus we now only compute whether a copy or move constructor is constexpr on demand, and only compute whether a default constructor is constexpr in advance. This is unfortunate, but seems like the best solution. llvm-svn: 158290
* Switch LineTableInfo to use FileID instead of int for file references,Douglas Gregor2012-06-081-2/+2
| | | | | | from Tom Honermann! llvm-svn: 158211
* Plug a long standing memory leak in TemplateArgument.Benjamin Kramer2012-06-071-1/+1
| | | | | | | | | | | | | | | The integral APSInt value is now stored in a decomposed form and the backing store for large values is allocated via the ASTContext. This way its not leaked as TemplateArguments are never destructed when they are allocated in the ASTContext. Since the integral data is immutable it is now shared between instances, making copying TemplateArguments a trivial operation. Currently getting the integral data out of a TemplateArgument requires creating a new APSInt object. This is cheap when the value is small but can be expensive if it's not. If this turns out to be an issue a more efficient accessor could be added. llvm-svn: 158150
* Remove unused private member variables found by clang's new ↵Benjamin Kramer2012-06-061-4/+3
| | | | | | -Wunused-private-field. llvm-svn: 158086
* A union can have a constexpr defaulted default constructor, if it has anRichard Smith2012-05-071-0/+1
| | | | | | | | | in-class initializer for one of its fields. Value-initialization of such a type should use the in-class initializer! The former was just a bug, the latter is a (reported) standard defect. llvm-svn: 156274
* Fix serialization of uninstantiated exception specifications. Patch by Li Kan,Richard Smith2012-04-211-0/+3
| | | | | | test by me. llvm-svn: 155289
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-1/+1
| | | | llvm-svn: 155082
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-0/+1
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* Canonicalize the declaration we write to a PCH file for anDouglas Gregor2012-03-261-1/+1
| | | | | | | | InjectedClassNameType; otherwise, it won't be properly wired to the original (canonical) declaration when it is deserialized. Fixes <rdar://problem/11112464>. llvm-svn: 153442
* Fix Objective-C compilation-time performance regression introduced in r152608.Richard Smith2012-03-161-2/+3
| | | | | | | | | | | | | | | | Reintroduce lazy name lookup table building, ensuring that the lazy building step produces the same lookup table that would be built by the eager step. Avoid building a lookup table for the translation unit outside C++, even in cases where we can't recover the contents of the table from the declaration chain on the translation unit, since we're not going to perform qualified lookup into it anyway. Continue to support lazily building such lookup tables for now, though, since ASTMerge uses them. In my tests, this performs very similarly to ToT with r152608 backed out, for C, Obj-C and C++, and does not suffer from PR10447. llvm-svn: 152905
* It never makes sense to do a lookup into a LinkageSpecDecl, so assert that weNick Lewycky2012-03-131-4/+0
| | | | | | | | | don't, and clean up the places that do it. The change to ASTWriter is surprising, but the deleted code is a no-op as of r152608. llvm-svn: 152609
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-4/+4
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-1/+0
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* [libclang] Fix a crash when serializing a preprocessing record that containsArgyrios Kyrtzidis2012-03-081-1/+4
| | | | | | | | an #include entry that did not resolve to header file. Part of rdar://11007039 llvm-svn: 152275
OpenPOWER on IntegriCloud