summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use MapVector::pop_back() per LLVM r175538.Douglas Gregor2013-02-191-1/+1
| | | | llvm-svn: 175539
* Ensure that the identifier chains have the most recent declaration after ↵Douglas Gregor2013-02-181-15/+34
| | | | | | | | | | | | | | | | | | | | | | | | | module deserialization. This commit introduces a set of related changes to ensure that the declaration that shows up in the identifier chain after deserializing declarations with a given identifier is, in fact, the most recent declaration. The primary change involves waiting until after we deserialize and wire up redeclaration chains before updating the identifier chains. There is a minor optimization in here to avoid recursively deserializing names as part of looking to see whether top-level declarations for a given name exist. A related change that became suddenly more urgent is to property record a merged declaration when an entity first declared in the current translation unit is later deserialized from a module (that had not been loaded at the time of the original declaration). Since we key off the canonical declaration (which is parsed, not from an AST file) for emitted redeclarations, we simply record this as a merged declaration during AST writing and let the readers merge them. Re-fixes <rdar://problem/13189985>, presumably for good this time. llvm-svn: 175447
* [PCH] Deserializing the DeclContext of a template parameter is not safeArgyrios Kyrtzidis2013-02-161-1/+11
| | | | | | | | | | | until recursive loading is finished. Otherwise we may end up with a template trying to deserialize a template parameter that is in the process of getting loaded. rdar://13135282 llvm-svn: 175329
* Order the methods in the global method pool based on when they become ↵Douglas Gregor2013-02-121-3/+40
| | | | | | visible, not when they become deserialized <rdar://problem/13203033>. llvm-svn: 175018
* [Modules] Cope better with top-level declarations loaded after being ↵Douglas Gregor2013-02-111-3/+23
| | | | | | | | | | | | | | | | | | | | declared in the current translation unit <rdar://problem/13189985>. These two related tweaks to keep the information associated with a given identifier correct when the identifier has been given some top-level information (say, a top-level declaration) and more information is then loaded from a module. The first ensures that an identifier that was "interesting" before being loaded from an AST is considered to be different from its on-disk counterpart. Otherwise, we lose such changes when writing the current translation unit as a module. Second, teach the code that injects AST-loaded names into the identifier chain for name lookup to keep the most recent declaration, so that we don't end up confusing our declaration chains by having a different declaration in there. llvm-svn: 174895
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-0/+1
| | | | | | restrictions. llvm-svn: 174601
* Simplify FindExternalVisibleDeclsByName by making it return a bool indicatingRichard Smith2013-02-071-4/+3
| | | | | | | | | | | | if it found any decls, rather than returning a list of found decls. This removes a returning-ArrayRef-to-deleted-storage bug from MultiplexExternalSemaSource (in code not exercised by any of the clang binaries), reduces the work required in the found-no-decls case with PCH, and importantly removes the need for DeclContext::lookup to be reentrant. No functionality change intended! llvm-svn: 174576
* Detect when we end up trying to load conflicting module files.Douglas Gregor2013-02-061-1/+12
| | | | | | | | | | | | This can happen when one abuses precompiled headers by passing more -D options when using a precompiled hedaer than when it was built. This is intentionally permitted by precompiled headers (and is exploited by some build environments), but causes problems for modules. First part of <rdar://problem/13165109>, detecting when something when horribly wrong. llvm-svn: 174554
* Remove dead code related to the now defunct PCH stat cache.Ted Kremenek2013-02-051-2/+0
| | | | llvm-svn: 174342
* Merge "special" types from different modules in the AST reader.Douglas Gregor2013-02-011-2/+18
| | | | | | | | | Different modules may have different views of the various "special" types in the AST, such as the redefinition type for "id". Merge those types rather than only considering the redefinition types for the first AST file loaded. llvm-svn: 174234
* [modules] Introduce ModuleFile::DirectImportLoc which is the source locationArgyrios Kyrtzidis2013-02-011-0/+1
| | | | | | where the module was explicitly or implicitly imported in the local translation unit. llvm-svn: 174192
* For ModuleLoader::makeModuleVisible() also pass the source location where theArgyrios Kyrtzidis2013-02-011-2/+4
| | | | | | module import occurred. llvm-svn: 174191
* Add a new -Wundefined-inline warning for inline functions which are used but notNick Lewycky2013-02-011-11/+10
| | | | | | defined. Fixes PR14993! llvm-svn: 174158
* Remove elements from Sema.UndefinedInternals as functions are defined. AlsoNick Lewycky2013-01-311-2/+2
| | | | | | | filter the elements before emitting them into a PCH. No user-visible functionality change, except that PCH files may be smaller? llvm-svn: 174034
* [Frontend] Remove HeaderSearchOptions::Entry::IsInternal, which is unused.Daniel Dunbar2013-01-301-3/+1
| | | | llvm-svn: 173866
* [Frontend] Add an ExternCSystem include entry group.Daniel Dunbar2013-01-301-2/+1
| | | | | | | | - The only group where it makes sense for the "ExternC" bit is System, so this simplifies having to have the extra isCXXAware (or ImplicitExternC, depending on what code you talk to) bit caried around. llvm-svn: 173859
* Add some more ASTReader statistics for global method pool lookups.Douglas Gregor2013-01-281-7/+23
| | | | llvm-svn: 173702
* Preserve Sema::UndefinedInternals across PCH boundaries. FixesNick Lewycky2013-01-261-1/+29
| | | | | | -Wundefined-internal warnings with PCH. llvm-svn: 173538
* Improve coordination between the module manager and the global moduleDouglas Gregor2013-01-251-19/+15
| | | | | | | | | index, optimizing the operation that skips lookup in modules where we know the identifier will not be found. This makes the global module index optimization actually useful, providing an 8.5% speedup over modules without the global module index for -fsyntax-only. llvm-svn: 173529
* [Frontend] Remove another IsUserSpecified member variable that is now unused.Daniel Dunbar2013-01-251-3/+2
| | | | llvm-svn: 173412
* Implement the reader of the global module index and wire it into theDouglas Gregor2013-01-251-8/+69
| | | | | | | | | | | | | | | | | | | | | | | AST reader. The global module index tracks all of the identifiers known to a set of module files. Lookup of those identifiers looks first in the global module index, which returns the set of module files in which that identifier can be found. The AST reader only needs to look into those module files and any module files not known to the global index (e.g., because they were (re)built after the global index), reducing the number of on-disk hash tables to visit. For an example source I'm looking at, we go from 237844 total identifier lookups into on-disk hash tables down to 126817. Unfortunately, this does not translate into a performance advantage. At best, it's a wash once the global module index has been built, but that's ignore the cost of building the global module index (which is itself fairly large). Profiles show that the global module index code is far less efficient than it should be; optimizing it might give enough of an advantage to justify its continued inclusion. llvm-svn: 173405
* Rename the -cc1 option "-generate-module-index" toDouglas Gregor2013-01-251-1/+2
| | | | | | | "-fmodules-global-index" and expand its behavior to include both the use and generation of the global module index. llvm-svn: 173404
* Track the number of lookups and hits into the on-disk hash tables forDouglas Gregor2013-01-251-9/+32
| | | | | | identifiers within the AST file reader. llvm-svn: 173403
* Implement the writer side of the global module index. Douglas Gregor2013-01-231-2/+3
| | | | | | | | | | | | | | | | | | | | The global module index is a "global" index for all of the module files within a particular subdirectory in the module cache, which keeps track of all of the "interesting" identifiers and selectors known in each of the module files. One can perform a fast lookup in the index to determine which module files will have more information about entities with a particular name/selector. This information can help eliminate redundant lookups into module files (a serious performance problem) and help with creating auto-import/auto-include Fix-Its. The global module index is created or updated at the end of a translation unit that has triggered a (re)build of a module by scraping all of the .pcm files out of the module cache subdirectory, so it catches everything. As with module rebuilds, we use the file system's atomicity to synchronize. llvm-svn: 173301
* Factor the trait for lookup into the on-based hash table ofDouglas Gregor2013-01-231-13/+11
| | | | | | | | | identifiers into two parts: the part that involves dealing with the key (which can be re-used) and the ASTReader-specific part that creates the IdentifierInfos. While I'm at it, StringRef'ify this code, which was using pair<const char*, unsigned>. No functionality change. llvm-svn: 173283
* Make getDefinitiveDeclContext() actually return a DeclContext, as oneDouglas Gregor2013-01-221-2/+2
| | | | | | | would expect, and clean up the return/break inconsistencies. Thanks, Sebastian! llvm-svn: 173171
* Switch to APFloat constructor taking fltSemantics.Tim Northover2013-01-221-2/+4
| | | | | | | | This change also makes the serialisation store the required semantics, fixing an issue where PPC128 was always assumed when re-reading a 128-bit value. llvm-svn: 173139
* ReadSourceManagerBlock is skipping over records that can contain Blobs. Not ↵Chris Lattner2013-01-211-1/+2
| | | | | | | | | passing in a StringRef to bind to them forces them to be unpacked into the Record as individual bytes. This is wasteful, but not likely to be measurable in this instance. llvm-svn: 173066
* Revert r173056; it breaks one of the CodeGen-with-PCH tests.Douglas Gregor2013-01-211-18/+8
| | | | llvm-svn: 173058
* When loading an identifier from an AST file solely for the purpose ofDouglas Gregor2013-01-211-8/+18
| | | | | | | | | | forming the identifier, e.g., as part of a selector or a declaration name, don't actually deserialize any information about the identifier. Instead, simply mark it "out-of-date" and we'll load the the information on demand. 2% speedup on the modules testcase I'm looking at; should also help PCH. llvm-svn: 173056
* Introduce a fast path for the ASTReader's name lookup within aDouglas Gregor2013-01-211-2/+32
| | | | | | | | | DeclContext. When the DeclContext is of a kind that can only be defined once and never updated, we limit the search to the module file that conatins the lookup table. Provides a 15% speedup in one modules-heavy source file. llvm-svn: 173050
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-0/+1
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* update to use the new BitcodeCursor readRecord that takes a StringRef blob ↵Chris Lattner2013-01-201-110/+78
| | | | | | | | parameter, and adopt "advance" in more places. llvm-svn: 172951
* add back a #include needed on some builders.Chris Lattner2013-01-201-0/+1
| | | | llvm-svn: 172938
* finish converting the normal cases in ASTReader to use the new ↵Chris Lattner2013-01-201-202/+147
| | | | | | BitstreamCursor APIs. llvm-svn: 172937
* convert some more stuff over to use new cursor APIs.Chris Lattner2013-01-201-37/+34
| | | | llvm-svn: 172932
* switch a bunch of ASTReader to use the new BitstreamCursor::advance* methods,Chris Lattner2013-01-191-162/+145
| | | | | | | which hide a bunch of private details of the cursor from clients and simplify their code. More to come. llvm-svn: 172922
* [PCH/Modules] Revert r172843, it caused a module to fail building.Argyrios Kyrtzidis2013-01-191-29/+26
| | | | llvm-svn: 172884
* Remove unused variableMatt Beaumont-Gay2013-01-181-1/+0
| | | | llvm-svn: 172862
* [PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!Argyrios Kyrtzidis2013-01-181-26/+30
| | | | | | | | | Makes sure that a deserialized macro is only added to the preprocessor macro definitions only once. Unfortunately I couldn't get a reduced test case. rdar://13016031 llvm-svn: 172843
* [ubsan] Add support for -fsanitize-blacklistWill Dietz2013-01-181-0/+2
| | | | llvm-svn: 172808
* Revert Clang r172620 and r172629, which caused a hang when buildingDouglas Gregor2013-01-181-21/+40
| | | | | | | complicated modules (<rdar://problem/13038265>). Unfortunately, this un-fixes <rdar://problem/13016031>. llvm-svn: 172783
* [PCH/Modules] The iterator may become invalidated because a new macro can be ↵Argyrios Kyrtzidis2013-01-161-2/+4
| | | | | | | | | | added while deserializing a macro, make sure to copy/move what we need from it. Fixes clang-x86_64-debian-fast bot. llvm-svn: 172629
* [PCH/Modules] Change how macro [re]definitions are de/serialized.Argyrios Kyrtzidis2013-01-161-40/+19
| | | | | | | | | | | | | | | | | | Previously we would serialize the macro redefinitions as a list, part of the identifier, and try to chain them together across modules individually without having the info that they were already chained at definition time. Change this by serializing the macro redefinition chain and then try to synthesize the chain parts across modules. This allows us to correctly pinpoint when 2 different definitions are ambiguous because they came from unrelated modules. Fixes bogus "ambiguous expansion of macro" warning when a macro in a PCH is redefined without undef'ing it first. rdar://13016031 llvm-svn: 172620
* Implement parsing, AST, (de-)serialization, and placeholder globalDouglas Gregor2013-01-141-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 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-16/+16
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Provide Decl::getOwningModule(), which determines the (sub)module inDouglas Gregor2013-01-121-1/+5
| | | | | | | | | | | | | which a particular declaration resides. Use this information to customize the "definition of 'blah' must be imported from another module" diagnostic with the module the user actually has to import. Additionally, recover by importing that module, so we don't complain about other names in that module. Still TODO: coming up with decent Fix-Its for these cases, and expand this recovery approach for other name lookup failures. llvm-svn: 172290
* [PCH] Make the const_cast explicit to silence a compiler warning.Argyrios Kyrtzidis2013-01-111-1/+2
| | | | | | Patch by David Greene. llvm-svn: 172262
* Truth in advertising: LocallyScopedExternalDecls actually only containsRichard Smith2013-01-101-7/+7
| | | | | | 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
OpenPOWER on IntegriCloud