summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Stop treating extension keywords as 'interesting'; we don't allow the extensionRichard Smith2015-07-171-3/+2
| | | | | | | flag to change between serialization and deserialization, so it does not require the identifier to be serialized. llvm-svn: 242567
* Refactor to remove repetition, no functionality change.Richard Smith2015-07-171-40/+27
| | | | llvm-svn: 242564
* Remove redundant bouncing between StringRef and a pair of 'const char *'.Richard Smith2015-07-171-2/+1
| | | | llvm-svn: 242562
* Make the clang module container format selectable from the command line.Adrian Prantl2015-07-171-10/+10
| | | | | | | | | | | | | - introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
* [modules] Avoid repeatedly hashing the same name when looking it up in ↵Richard Smith2015-07-141-45/+55
| | | | | | multiple module files. llvm-svn: 242180
* Extend -ftime-report to give more information about time spent reading ↵Richard Smith2015-07-141-1/+11
| | | | | | module files. llvm-svn: 242094
* Minor simplification, no functionality change.Richard Smith2015-07-121-3/+2
| | | | llvm-svn: 242001
* [modules] Improve performance when there is a local declaration of an entityRichard Smith2015-07-121-10/+10
| | | | | | | | before the first imported declaration. We don't need to track all formerly-canonical declarations of an entity; it's sufficient to track those ones for which no other formerly-canonical declaration was imported into the same module. We call those ones "key declarations", and use them as our starting points for collecting redeclarations and performing namespace lookups. llvm-svn: 241999
* Revert "Revert r241620 and follow-up commits" and move the initializationAdrian Prantl2015-07-081-2/+1
| | | | | | of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. llvm-svn: 241653
* Revert r241620 and follow-up commits while investigating linux buildbot ↵Adrian Prantl2015-07-071-1/+2
| | | | | | failures. llvm-svn: 241642
* Wrap clang modules and pch files in an object file container.Adrian Prantl2015-07-071-2/+1
| | | | | | | | | | | | | This patch adds ObjectFilePCHContainerOperations uses the LLVM backend to put the contents of a PCH into a __clangast section inside a COFF, ELF, or Mach-O object file container. This is done to facilitate module debugging by makeing it possible to store the debug info for the types defined by a module alongside the AST. rdar://problem/20091852 llvm-svn: 241620
* Implement the Objective-C __kindof type qualifier.Douglas Gregor2015-07-071-1/+2
| | | | | | | | | | The __kindof type qualifier can be applied to Objective-C object (pointer) types to indicate id-like behavior, which includes implicit "downcasting" of __kindof types to subclasses and id-like message-send behavior. __kindof types provide better type bounds for substitutions into unspecified generic types, which preserves more type information. llvm-svn: 241548
* Handle Objective-C type arguments.Douglas Gregor2015-07-071-3/+11
| | | | | | | | | | | | | | | | | | | | | Objective-C type arguments can be provided in angle brackets following an Objective-C interface type. Syntactically, this is the same position as one would provide protocol qualifiers (e.g., id<NSCopying>), so parse both together and let Sema sort out the ambiguous cases. This applies both when parsing types and when parsing the superclass of an Objective-C class, which can now be a specialized type (e.g., NSMutableArray<T> inherits from NSArray<T>). Check Objective-C type arguments against the type parameters of the corresponding class. Verify the length of the type argument list and that each type argument satisfies the corresponding bound. Specializations of parameterized Objective-C classes are represented in the type system as distinct types. Both specialized types (e.g., NSArray<NSString *> *) and unspecialized types (NSArray *) are represented, separately. llvm-svn: 241542
* Add a function to ExternalASTSource that returns a descriptor thatAdrian Prantl2015-06-301-0/+32
| | | | | | | abstracts the commonalities between modules and PCH files that are needed to emit debug info for a module or precompiled header. llvm-svn: 241083
* Use AddString/ReadString instead of doing it manually NFCBen Langmuir2015-06-231-5/+1
| | | | llvm-svn: 240434
* [Modules] Consider -fmodule-feature in module hash and when loadingBen Langmuir2015-06-231-0/+9
| | | | | | | Any extra features from -fmodule-feature are part of the module hash and need to get validated on load. Also print them with -module-file-info. llvm-svn: 240433
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-11/+10
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-10/+11
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* ASTReader: Treat InputFileOffsets as unaligned to avoid UBJustin Bogner2015-06-211-1/+2
| | | | | | | | | | This is a better approach to fixing the undefined behaviour I tried to fix in r240228. This data doesn't necessarily have suitable alignment for uint64_t, so use unaligned_uint64_t instead. This fixes 225 test failures when clang is built with ubsan. llvm-svn: 240247
* Revert "ASTReader: Copy input file offset data to avoid unaligned accesses"Justin Bogner2015-06-211-10/+2
| | | | | | | | | We can do this better by changing the type to unaligned_uint64_t and paying the cost on use instead of up front. This reverts r240228 llvm-svn: 240246
* ASTReader: Copy input file offset data to avoid unaligned accessesJustin Bogner2015-06-201-2/+10
| | | | | | | | | | We interpret Blob as an array of uint64_t here, but there's no reason to think that it has suitable alignment. Instead, read the data in in an alignment-safe way and store it in a std::vector. This fixes 225 test failures when clang is built with ubsan. llvm-svn: 240228
* Introduce a PCHContainerOperations interface (NFC).Adrian Prantl2015-06-201-26/+29
| | | | | | | | | | | | | | | | A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-4/+3
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
* Allow skipping imports in the module visitor.Manuel Klimek2015-05-201-5/+3
| | | | | | | Skip imports when we know that we do not need to visit any imports because we've already deserialized the redecls from a module. llvm-svn: 237782
* Detect uses of mismatching forms of 'new' and 'delete'Ismail Pazarbasi2015-05-181-0/+27
| | | | | | | | | | | | | | | | | Emit warning when operand to `delete` is allocated with `new[]` or operand to `delete[]` is allocated with `new`. rev 2 update: `getNewExprFromInitListOrExpr` should return `dyn_cast_or_null` instead of `dyn_cast`, since `E` might be null. Reviewers: rtrieu, jordan_rose, rsmith Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4661 llvm-svn: 237608
* [modules] Retain the name as written for umbrella headers and directories, ↵Richard Smith2015-05-161-7/+10
| | | | | | rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require. llvm-svn: 237508
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-151-1/+6
| | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
* Revert "Detect uses of mismatching forms of 'new' and 'delete'"Diego Novillo2015-05-141-27/+0
| | | | | | | | | This reverts commit 742dc9b6c9686ab52860b7da39c3a126d8a97fbc. This is generating multiple segfaults in our internal builds. Test case coming up shortly. llvm-svn: 237391
* Detect uses of mismatching forms of 'new' and 'delete'Ismail Pazarbasi2015-05-141-0/+27
| | | | | | | | | | | | | Emit warning when operand to `delete` is allocated with `new[]` or operand to `delete[]` is allocated with `new`. Reviewers: rtrieu, jordan_rose, rsmith Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4661 llvm-svn: 237368
* [modules] Don't bother registering loaded macros if there are none.Richard Smith2015-05-041-1/+2
| | | | | | We don't yet have a reduced testcase for this. llvm-svn: 236454
* Rename MacroDefinition -> MacroDefinitionRecord, ↵Richard Smith2015-05-041-10/+10
| | | | | | | | | | Preprocessor::MacroDefinition -> MacroDefinition. clang::MacroDefinition now models the currently-defined value of a macro. The previous MacroDefinition type, which represented a record of a macro definition directive for a detailed preprocessing record, is now called MacroDefinitionRecord. llvm-svn: 236400
* [modules] Remove dead code from Module for tracking macro import locations.Richard Smith2015-05-021-7/+1
| | | | llvm-svn: 236376
* [modules] If a module #includes a modular header that #undef's its macro, itRichard Smith2015-05-021-1/+1
| | | | | | | | should not export the macro. ... at least, not unless we have local submodule visibility enabled. llvm-svn: 236369
* [modules] Start moving the module visibility information off the Module itself.Richard Smith2015-05-011-22/+7
| | | | | | | It has no place there; it's not a property of the Module, and it makes restoring the visibility set when we leave a submodule more difficult. llvm-svn: 236300
* Remove dead code: a MacroDirective can't be imported or ambiguous any more.Richard Smith2015-04-301-12/+2
| | | | llvm-svn: 236197
* [modules] Stop trying to fake up a linear MacroDirective history.Richard Smith2015-04-291-191/+2
| | | | | | | | | | | | | | Modules builds fundamentally have a non-linear macro history. In the interest of better source fidelity, represent the macro definition information faithfully: we have a linear macro directive history within each module, and at any point we have a unique "latest" local macro directive and a collection of visible imported directives. This also removes the attendent complexity of attempting to create a correct MacroDirective history (which we got wrong in the general case). No functionality change intended. llvm-svn: 236176
* [modules] Refactor creation of ModuleMacros and create them when importing ↵Richard Smith2015-04-231-7/+6
| | | | | | from local submodules. llvm-svn: 235669
* [modules] Remove the now-redundant import of all pending macros at the end ↵Richard Smith2015-04-231-27/+8
| | | | | | | | | of building a module. Since we now track module macros separately from their visibility state, this is no longer necessary. llvm-svn: 235648
* [modules] Store a ModuleMacro* on an imported macro directive rather than ↵Richard Smith2015-04-231-61/+39
| | | | | | duplicating the info within it. llvm-svn: 235644
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-231-3/+4
| | | | | | | | | | | that submodule. Previously we'd defer this determination until writing the AST, which doesn't allow us to use this information when building other submodules of the same module. This change also allows us to use a uniform mechanism for writing module macro records, independent of whether they are local or imported. llvm-svn: 235614
* Silencing a -Wunused-variable warning; NFC.Aaron Ballman2015-04-221-2/+1
| | | | llvm-svn: 235512
* [modules] Cope with partial module macro information, fix memory leak found ↵Richard Smith2015-04-221-6/+4
| | | | | | by buildbot. llvm-svn: 235464
* [modules] Build a DAG of module macros for each identifier.Richard Smith2015-04-221-28/+36
| | | | | | | | This graph will be used to determine the current set of active macros. This is foundation work for getting macro visibility correct across submodules of the current module. No functionality change for now. llvm-svn: 235461
* [modules] Move list of exported module macros from IdentifierInfo lookup ↵Richard Smith2015-04-211-138/+81
| | | | | | | | | table to separate storage, adjacent to the macro directive history. This is substantially simpler, provides better space usage accounting in bcanalyzer, and gives a more compact representation. No functionality change intended. llvm-svn: 235420
* Workaround a performance issue with modules + PCHBen Langmuir2015-04-101-1/+4
| | | | | | | | | | | | More fallout from r228234; when looking up an identifier in a PCH that imports the Cocoa module on Darwin, it was taking 2 to 5 seconds because we were hammering the MapVector::erase() function, which is O(n). For now, just clear() the contained SmallVector to get back to 0.25 - 0.5 seconds. This is probably not the long-term fix, because without modules or without PCH the performance is more like 0.02 seconds. llvm-svn: 234655
* [modules] Remove unused MACRO_TABLE record.Richard Smith2015-04-101-5/+0
| | | | llvm-svn: 234555
* [modules] When merging class definitions, make the retained definition visibleRichard Smith2015-03-271-14/+8
| | | | | | | | if the merged definition is visible, and perform lookups into all merged copies of the definition (not just for special members) so that we can complete the redecl chains for members of the class. llvm-svn: 233420
* [Modules] Preserve source order for the map of late parsed templates.Chandler Carruth2015-03-261-2/+2
| | | | | | | | | | | | | | | | | | | | Clang was inserting these into a dense map. While it never iterated the dense map during normal compilation, it did when emitting a module. Fix this by using a standard MapVector to preserve the order in which we encounter the late parsed templates. I suspect this still isn't ideal, as we don't seem to remove things from this map even when we mark the templates as no longer late parsed. But I don't know enough about this particular extension to craft a nice, subtle test case covering this. I've managed to get the stress test to at least do some late parsing and demonstrate the core problem here. This patch fixes the test and provides deterministic behavior which is a strict improvement over the prior state. I've cleaned up some of the code here as well to be explicit about inserting when that is what is actually going on. llvm-svn: 233264
* [modules] Deserialize CXXCtorInitializer list for a constructor lazily.Richard Smith2015-03-241-79/+117
| | | | | | | | | | | | | Previously we'd deserialize the list of mem-initializers for a constructor when we deserialized the declaration of the constructor. That could trigger a significant amount of unnecessary work (pulling in all base classes recursively, for a start) and was causing problems for the modules buildbot due to cyclic deserializations. We now deserialize these on demand. This creates a certain amount of duplication with the handling of CXXBaseSpecifiers; I'll look into reducing that next. llvm-svn: 233052
* A couple of readASTFileSignature improvements (NFC)Ben Langmuir2015-03-241-18/+14
| | | | | | | | | | * Strength reduce a std::function to a function pointer, * Factor out checking the AST file magic number, * Add a brief doc comment to readAStFileSignature Thanks to Chandler for spotting these oddities. llvm-svn: 233050
OpenPOWER on IntegriCloud