summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix read of uninitialized enum value in test, caught by UBSan. No functionalityRichard Smith2013-07-311-1/+1
| | | | | | change, other than removal of undefined behavior. llvm-svn: 187465
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-051-1/+1
| | | | llvm-svn: 185715
* Use typedef for Densemap contraining SmallVector passed to a function to ↵Craig Topper2013-07-051-6/+4
| | | | | | avoid repeating SmallVector size. llvm-svn: 185683
* Add typedefs for Densemaps containing SmallVectors to avoid repeating the ↵Craig Topper2013-07-051-8/+10
| | | | | | SmallVector size when creating iterators for the DenseMap. llvm-svn: 185682
* [AST] Introduce a new DecayedType sugar nodeReid Kleckner2013-06-241-0/+15
| | | | | | | | | | | | | | The goal of this sugar node is to be able to look at an arbitrary FunctionType and tell if any of the parameters were decayed from an array or function type. Ultimately this is necessary to implement Microsoft's C++ name mangling scheme, which mangles decayed arrays differently from normal pointers. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1014 llvm-svn: 184763
* This patch adds new private headers to the module map. PrivateLawrence Crowl2013-06-201-1/+18
| | | | | | | headers may be included from within the module, but not from outside the module. llvm-svn: 184471
* Loosen r178109 even further, to assume that all redefined macros in system ↵Douglas Gregor2013-06-071-7/+10
| | | | | | | | headers and system modules are equivalent. Fixes <rdar://problem/14025673>. llvm-svn: 183588
* [PCH] Fix crash with valid code, related to anonymous field initializers.Argyrios Kyrtzidis2013-05-301-3/+10
| | | | | | | | | In a certain code-path we were not deserializing an anonymous field initializer correctly, leading to a crash when trying to IRGen it. This is a simpler version of a patch by Yunzhong Gao! llvm-svn: 182974
* [modules] If we hit a failure while loading a PCH/module, abort parsing ↵Argyrios Kyrtzidis2013-05-241-1/+4
| | | | | | | | | | instead of trying to continue in an invalid state. Also don't let libclang create a PCH with such an error. Fixes rdar://13953768 llvm-svn: 182629
* [Modules] When things go horribly wrong when reading a module, point at the ↵Douglas Gregor2013-05-101-0/+8
| | | | | | | | | | module cache. Sometimes people hack on their system headers. In such cases, they'll need to delete their module cache, but may not know where it is. Add a note to show them where it is. llvm-svn: 181638
* [PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.Argyrios Kyrtzidis2013-05-081-10/+1
| | | | | | | | This made sense in pre-module era, before merging of HeaderFileInfos was introduced. Final part of rdar://13840148. llvm-svn: 181490
* Modify ASTReaderListener to allow visiting the input files of an AST file.Argyrios Kyrtzidis2013-05-061-8/+58
| | | | | | We can pass such an input-file-visiting ASTReaderListener to ASTReader::readASTFileControlBlock. llvm-svn: 181238
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-8/+15
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-301-1/+2
| | | | | | | | are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. llvm-svn: 180789
* [PCH/modules] Require the preprocessing record option to match the used PCH, ↵Argyrios Kyrtzidis2013-04-261-3/+15
| | | | | | | | | if modules are enabled. The preprocessing record becomes important when modules are enabled, since it is used to calculate the module cache hash. llvm-svn: 180635
* [Modules] Fix an issue where the reconstructed redeclaration chain was ↵Argyrios Kyrtzidis2013-04-261-6/+19
| | | | | | | | | | | | | incomplete, missing the definition from a module. -Make sure that a deserialized external decl gets added to the TU scope. -When associating an identifier with a set of decls, use the most recent local ones, if they exist, otherwise associating decls from modules (that came after a local one) will lead to an incomplete reconstructed re-declaration chain. rdar://13712705 llvm-svn: 180634
* Implement C++1y decltype(auto).Richard Smith2013-04-261-2/+5
| | | | llvm-svn: 180610
* [Modules] Use global index to improve typo correction performanceArgyrios Kyrtzidis2013-04-171-1/+4
| | | | | | | | | Typo correction for an unqualified name needs to walk through all of the identifier tables of all modules. When we have a global index, just walk its identifier table only. rdar://13425732 llvm-svn: 179730
* Enhance the ObjC global method pool to record whether there were 0, 1, or >= ↵Argyrios Kyrtzidis2013-04-171-6/+20
| | | | | | | | | 2 methods (with a particular selector) inside categories. This is done by extending ObjCMethodList (which is only used by the global method pool) to have 2 extra bits of information. We will later take advantage of this info in global method pool for the overridden methods calculation. llvm-svn: 179652
* <rdar://problem/13643854> Only emit ambiguous-expansion warnings when at ↵Douglas Gregor2013-04-121-26/+8
| | | | | | | | least one of the macro definitions comes from a non-system header. This slightly weakens the heuristic introduced in r178109. llvm-svn: 179411
* Add an option to parse all comments as documentation commentsDmitri Gribenko2013-04-101-3/+4
| | | | | | Patch by Amin Shali. llvm-svn: 179180
* Pare back r164351 somewhat. The problem that change was addressing was that weRichard Smith2013-04-031-1/+7
| | | | | | | | don't serialize a lookup map for the translation unit outside C++ mode, so we can't tell when lookup within the TU needs to look within modules. Only apply the fix outside C++ mode, and only to the translation unit. llvm-svn: 178706
* [preprocessor] Allow comparing two macro definitions syntactically instead ↵Argyrios Kyrtzidis2013-04-031-1/+2
| | | | | | | | | | | | | | of only lexically. Syntactically means the function macro parameter names do not need to use the same identifiers in order for the definitions to be considered identical. Syntactic equivalence is a microsoft extension for macro redefinitions and we'll also use this kind of comparison to check for ambiguous macros coming from modules. rdar://13562254 llvm-svn: 178671
* <rdar://problem/13509689> Introduce -module-file-info option that provides ↵Douglas Gregor2013-03-271-3/+2
| | | | | | | | | | | information about a particular module file. This option can be useful for end users who want to know why they ended up with a ton of different variants of the "std" module in their module cache. This problem should go away over time, as we reduce the need for module variants, but it will never go away entirely. llvm-svn: 178148
* [modules] Before marking the module imported macros as ambiguous, check if ↵Argyrios Kyrtzidis2013-03-271-11/+57
| | | | | | | | | | | | | this is a case where the system macro uses a not identical definition compared to a macro from the clang headers. For example (these come from different modules): \#define LONG_MAX __LONG_MAX__ (clang's limits.h) \#define LONG_MAX 0x7fffffffffffffffL (system's limits.h) in which case don't mark them ambiguous to avoid the "ambiguous macro expansion" warning. llvm-svn: 178109
* [PCH/modules] Remove HiddenName::MacroUndefArgyrios Kyrtzidis2013-03-271-5/+0
| | | | llvm-svn: 178107
* [Preprocessor] Remove PPMutationListener.Argyrios Kyrtzidis2013-03-271-1/+1
| | | | | | It's not used anymore. llvm-svn: 178106
* [Preprocessor/Modules] Separate the macro directives kinds into their own ↵Argyrios Kyrtzidis2013-03-261-33/+36
| | | | | | | | | | | | | | | | MacroDirective's subclasses. For each macro directive (define, undefine, visibility) have a separate object that gets chained to the macro directive history. This has several benefits: -No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like PPMutationListener become unnecessary. -No need to keep extra source locations for the undef/visibility locations for the define directive object (which is the majority of the directives) -Much easier to hide/unhide a section in the macro directive history. -Easier to track the effects of the directives across different submodules. llvm-svn: 178037
* [PCH/Modules] De/Serialize MacroInfos separately than MacroDirectives.Argyrios Kyrtzidis2013-03-221-135/+179
| | | | | | | | | -Serialize the macro directives history into its own section -Get rid of the macro updates section -When de/serializing an identifier from a module, associate only one macro per submodule that defined+exported it. llvm-svn: 177761
* [modules] When a MacroInfo object is deserialized, allocate and store its ↵Argyrios Kyrtzidis2013-03-221-1/+1
| | | | | | submodule ID. llvm-svn: 177760
* <rdar://problem/13479539> Simplify ModuleManager/GlobalModuleIndex ↵Douglas Gregor2013-03-221-1/+6
| | | | | | | | | | | | | | interaction to eliminate a pile of extraneous stats(). The refactoring in r177367 introduced a serious performance bug where the "lazy" resolution of module file names in the global module index to actual module file entries in the module manager would perform repeated negative stats(). The new interaction requires the module manager to inform the global module index when a module file has been loaded, eliminating the extraneous stat()s and a bunch of bookkeeping on both sides. llvm-svn: 177750
* <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, ↵Douglas Gregor2013-03-201-18/+68
| | | | | | and warn when a newly-imported module conflicts with an already-imported module. llvm-svn: 177577
* Make sure that Module::ConfigMacrosExhaustive gets initialized and ↵Douglas Gregor2013-03-201-3/+6
| | | | | | | | | deserialized correctly. This fixes regressions introduced in r177466 that caused several module tests to fail sporadically. llvm-svn: 177481
* <rdar://problem/10796651> Introduce configuration macros into module maps.Douglas Gregor2013-03-201-0/+12
| | | | | | | | | | | | | | | | | | | | | | Configuration macros are macros that are intended to alter how a module works, such that we need to build different module variants for different values of these macros. A module can declare its configuration macros, in which case we will complain if the definition of a configation macro on the command line (or lack thereof) differs from the current preprocessor state at the point where the module is imported. This should eliminate some surprises when enabling modules, because "#define CONFIG_MACRO ..." followed by "#include <module/header.h>" would silently ignore the CONFIG_MACRO setting. At least it will no longer be silent about it. Configuration macros are eventually intended to help reduce the number of module variants that need to be built. When the list of configuration macros for a module is exhaustive, we only need to consider the settings for those macros when building/finding the module, which can help isolate modules for various project-specific -D flags that should never affect how modules are build (but currently do). llvm-svn: 177466
* Minor optimization to r177367 to treat a module with missing dependencies as ↵Douglas Gregor2013-03-191-1/+1
| | | | | | out-of-date rather than missing. llvm-svn: 177369
* <rdar://problem/13363214> Eliminate race condition between module rebuild ↵Douglas Gregor2013-03-191-26/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | and the global module index. The global module index was querying the file manager for each of the module files it knows about at load time, to prune out any out-of-date information. The file manager would then cache the results of the stat() falls used to find that module file. Later, the same translation unit could end up trying to import one of the module files that had previously been ignored by the module cache, but after some other Clang instance rebuilt the module file to bring it up-to-date. The stale stat() results in the file manager would trigger a second rebuild of the already-up-to-date module, causing failures down the line. The global module index now lazily resolves its module file references to actual AST reader module files only after the module file has been loaded, eliminating the stat-caching race. Moreover, the AST reader can communicate to its caller that a module file is missing (rather than simply being out-of-date), allowing us to simplify the module-loading logic and allowing the compiler to recover if a dependent module file ends up getting deleted. llvm-svn: 177367
* [Modules] Don't eagerly load and associate all the module header files.Argyrios Kyrtzidis2013-03-131-15/+22
| | | | | | | | | | | | | | In a module-enabled Cocoa PCH file, we spend a lot of time stat'ing the headers in order to associate the FileEntries with their modules and support implicit module import. Use a more lazy scheme by enhancing HeaderInfoTable to store extra info about the module that a header belongs to, and associate it with its module only when there is a request for loading the header info for a particular file. Part of rdar://13391765 llvm-svn: 176976
* [Modules] Resolve top-headers of modules lazily.Argyrios Kyrtzidis2013-03-131-3/+1
| | | | | | | | | | | This allows resolving top-header filenames of modules to FileEntries when we need them, not eagerly. Note that that this breaks ABI for libclang functions clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders but this is fine because they are experimental and not widely used yet. llvm-svn: 176975
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-2/+1
| | | | | | No (intended) functionality change. llvm-svn: 176726
* [PCH] When complaining that a header from the PCH was modified, also mentionArgyrios Kyrtzidis2013-03-081-1/+1
| | | | | | the filename of the PCH file. llvm-svn: 176717
* [libclang] Introduce clang_findIncludesInFile, that can be used to retrieve ↵Argyrios Kyrtzidis2013-03-081-2/+2
| | | | | | | | | all #import/#include directives in a specific file. It passes to the visitor, that the caller provides, CXCursor_InclusionDirective cursors for all the include directives in a particular file. llvm-svn: 176682
* [PCH] When pre-validating the headers from the PCH, only validate non-system ↵Argyrios Kyrtzidis2013-03-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | headers. Stat'ing all the headers from the PCH to make sure they are up-to-date takes significant time. In a particular source file (whose PCH file included Cocoa.h) from total -fsyntax-only time 12% was just stat calls. Change pre-validation to only check non-system headers. There are some notable disadvantages: -If a system header, that is not include-guarded, changes after the PCH was created, we will not find it in the header info table and we will #import it, effectively #importing it twice, thus we will emit some error due to a multiple definition and after that the "header was modified" error will likely be emitted, for example something like: NSDictionary.h:12:1: error: duplicate interface definition for class 'NSDictionary' @interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration> ^ NSDictionary.h:12:12: note: previous definition is here @interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration> ^ fatal error: file 'NSDictionary.h' has been modified since the precompiled header was built Though we get the "header was modified" error, this is a bit confusing. -Theoretically it is possible that such a system header will cause no errors but it will just cause an unfortunate semantic change, though I find this rather unlikely. The advantages: -Reduces compilation time when using a huge PCH like the Cocoa ones -System headers change very infrequent and when they do, users/build systems should be able to know that re-building from scratch is needed. Addresses rdar://13056262 llvm-svn: 176567
* [PCH] For HeaderFileInfoTrait, hash the key using size & time of the file.Argyrios Kyrtzidis2013-03-061-14/+28
| | | | | | | | | | | | Previously the hash would be the filename portion of the path, which could be different for a filename with different case or a symbolic link with a different name completely. This did not actually create any issue so far because by validating all headers in the PCH we created uniqued FileEntries based on inodes, so an #include of a symbolic link (refering to a file from the PCH) would end up with a FileEntry with filename same as the one recorded in the PCH. llvm-svn: 176566
* [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more ↵Argyrios Kyrtzidis2013-03-061-11/+4
| | | | | | | | than once. We can just re-use the one from HeaderFileInfoLookupTable. llvm-svn: 176565
* [PCH] Remove a couple of fields from ↵Argyrios Kyrtzidis2013-03-061-2/+1
| | | | | | serialization::reader::HeaderFileInfoTrait that are not used for anything. llvm-svn: 176564
* [PCH] In HeaderFileInfoTrait::EqualKey(), use FileManager::getFile() to ↵Argyrios Kyrtzidis2013-03-041-5/+4
| | | | | | | | | compare two filenames, instead of llvm::sys::fs::equivalent(). llvm::sys::fs::equivalent() does 2 stat calls every time it's called. Use FileManager::getFile() to take advantage of the stat caching that FileManager is providing. llvm-svn: 176450
* [PCH] Enhance InputFile to also include whether the file is out-of-date.Argyrios Kyrtzidis2013-03-011-20/+24
| | | | | | | Previously we would return null for an out-of-date file. This inhibited ASTReader::ReadSLocEntry from creating a FileID to recover gracefully in such a case. llvm-svn: 176332
* [PCH] When deserializing an IdentifierInfo, call ↵Argyrios Kyrtzidis2013-02-271-1/+1
| | | | | | | | | IdentifierInfo::RevertTokenIDToIdentifier() only when it's not already an identifier. Fixes an assertion hit. rdar://13288735 llvm-svn: 176148
* [preprocessing record] Have the MacroDefinitions map point to the ↵Argyrios Kyrtzidis2013-02-221-2/+6
| | | | | | | | | | MacroDefinition object instead its index in the preprocessed entities vector. This is because the order of the entities in the vector can change in some (uncommon) cases. llvm-svn: 175907
* Comment parsing: add CommentOptions to allow specifying custom comment block ↵Dmitri Gribenko2013-02-221-0/+17
| | | | | | | | | | | | | | | | commands Add an ability to specify custom documentation block comment commands via a new class CommentOptions. The intention is that this class will hold future customizations for comment parsing, including defining documentation comments with specific numbers of parameters, etc. CommentOptions instance is a member of LangOptions. CommentOptions is controlled by a new command-line parameter -fcomment-block-commands=Foo,Bar,Baz. llvm-svn: 175892
OpenPOWER on IntegriCloud