aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization
AgeCommit message (Collapse)AuthorFilesLines
2012-11-30When we're emitting a diagnostic with a source location in an importedDouglas Gregor1-0/+19
module, provide a module import stack similar to what we would get for an include stack, e.g., In module 'DependsOnModule' imported from build-fail-notes.m:4: In module 'Module' imported from DependsOnModule.framework/Headers/DependsOnModule.h:1: Inputs/Module.framework/Headers/Module.h:15:12: note: previous definition is here @interface Module <rdar://problem/12696425> llvm-svn: 169042
2012-11-30Actually keep track of the source locations at which particular moduleDouglas Gregor2-6/+11
files are loaded. llvm-svn: 169027
2012-11-30Refactor to reduce duplication in handling of special member functions. No ↵Richard Smith2-36/+8
functionality change. llvm-svn: 168977
2012-11-28Store on the CXXRecordDecl whether the class has, or would have, a copyRichard Smith2-0/+8
constructor/assignment operator with a const-qualified parameter type. The prior method for determining this incorrectly used overload resolution. llvm-svn: 168775
2012-11-28Introduce ASTUnresolvedSet, an UnresolvedSet-like class, whose contents areArgyrios Kyrtzidis3-5/+6
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
2012-11-15[modules] Use a memory buffer directly as input for the module includes,Argyrios Kyrtzidis2-0/+9
instead of messing with virtual files. llvm-svn: 168062
2012-11-15[modules] Setup the import location of a module file and use itArgyrios Kyrtzidis2-9/+31
as the include location of the main file of an imported module. llvm-svn: 168061
2012-11-14Suppress elided variadic macro argument extension diagnostic for macros usingEli Friedman2-0/+3
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
2012-11-09Add a FileCharacteristic parameter to SourceManager::createFileIDForMemBufferArgyrios Kyrtzidis1-2/+4
for completeness and use it in CompilerInstance::InitializeSourceManager if the input is a memory buffer. llvm-svn: 167628
2012-11-08Allow to pass from syntactic form of InitListExpr to semantic form (just as ↵Abramo Bagnara2-1/+4
viceversa). No functionality change. llvm-svn: 167591
2012-11-07When loading a module fails because it is out of date, rebuild thatDouglas Gregor2-9/+53
module in place. <rdar://problem/10138913> llvm-svn: 167539
2012-11-07PR13552: Fix the end location of a CXXNewExpr.David Blaikie2-2/+2
Spent longer than reasonable looking for a nice way to test this & decided to give up for now. Open to suggestions/requests. Richard Smith suggested adding something to ASTMatchers but it wasn't readily apparent how to test this with that. llvm-svn: 167507
2012-11-06Tease out the routine that reads the control block of an AST file fromDouglas Gregor1-26/+34
the validation of an AST file against a specific set of options. llvm-svn: 167504
2012-11-06[PCH] Take into account the 'include' source location of a SM_SLOC_BUFFER_ENTRY.Argyrios Kyrtzidis1-1/+3
llvm-svn: 167426
2012-11-06[PCH] Write out the ClassTemplateDecl::Common::InjectedClassNameType typeArgyrios Kyrtzidis2-3/+3
reference instead of relying on computing it. In general, if storage is no issue, it is preferable to deserialize info from the PCH instead of trying to recompute it after the PCH was loaded. The incentive to change this now was due to r155303 changing how friend template classes in dependent contexts are handled; such classes can now be chained to a previous template class but the computed InjectedClassNameType may be different due to the extra template parameters from the dependent context. The new handling requires more investigation but, in the meantime, writing out InjectedClassNameType fixes PCH issue in rdar://12627738. llvm-svn: 167425
2012-11-02[libclang] Correct how the index inside the local preprocessed entities arrayArgyrios Kyrtzidis1-5/+3
is getting converted to a global PreprocessedEntityID. llvm-svn: 167280
2012-10-31[PCH] Remove the stat cache from the PCH file.Argyrios Kyrtzidis4-169/+7
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
2012-10-30getOriginalSourceFileName and getOriginalSourceFile can return a StringRef.Rafael Espindola1-6/+5
MaybeAddSystemRootToFilename doesn't need to return anything, it modifies its argument. llvm-svn: 166988
2012-10-30[PCH] The diagnostic state points can refer to previously createdArgyrios Kyrtzidis2-14/+37
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
2012-10-25Remove the old predefines-buffer diffing code completely. It's beenDouglas Gregor1-332/+1
replaced by the more efficient, cleaner preprocessor-option version that occurs earlier in PCH validation. llvm-svn: 166654
2012-10-25Fix computation of predefines buffer from the preprocessor-optionDouglas Gregor1-10/+1
checking, and disable the old predefines-buffer-diff'ing code path. llvm-svn: 166653
2012-10-25The the preprocessor option validator to compute suggestedDouglas Gregor1-14/+72
predefines. We're not quite ready to cut over to these suggested predefines yet, however. llvm-svn: 166648
2012-10-24Teach the PCH validator to check the preprocessor options, especiallyDouglas Gregor2-6/+129
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
2012-10-24(De-)serialize the preprocessor options, including macros defined,Douglas Gregor2-3/+75
-include'd files, etc. llvm-svn: 166614
2012-10-24(De-)serialize header search options.Douglas Gregor2-2/+101
llvm-svn: 166586
2012-10-24(De-)serialize the file system options.Douglas Gregor2-1/+27
llvm-svn: 166577
2012-10-24Serialize DiagnosticOptions to the AST file.Douglas Gregor2-0/+45
llvm-svn: 166572
2012-10-23If the precompiled header named by "-include" is actually a directory,Douglas Gregor1-82/+235
check each of the files within that directory to determine if any of them is an AST file that matches the language and target options. If so, the first matching AST file is loaded. This fixes a longstanding discrepency with GCC's precompiled header implementation. llvm-svn: 166469
2012-10-22Allow clients of the AST reader to specify what kinds of AST loadDouglas Gregor1-62/+108
failures they know how to tolerate, e.g., out-of-date input files or configuration/version mismatches. Suppress the corresponding diagnostics if the client can handle it. No clients actually use this functionality, yet. llvm-svn: 166449
2012-10-22Collapse ASTReader::ReadSLocEntryRecord() into its only caller,Douglas Gregor1-8/+3
ReadSLocEntry(). No functionality change. llvm-svn: 166447
2012-10-22Distinguish the various kinds of AST file loading failures:Douglas Gregor1-112/+90
file corruption, compiler version mismatch, target/language configuration mismatch, out-of-date AST file. No functionality change yet. llvm-svn: 166446
2012-10-22ASTReader.cpp: Fix a warning. [-Wunused-variable]NAKAMURA Takumi1-0/+1
llvm-svn: 166442
2012-10-22Eliminate the redundancy between source-file information in the sourceDouglas Gregor2-201/+174
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
2012-10-19ASTWriter.cpp: Fix a warning. [-Wunused-variable]NAKAMURA Takumi1-2/+1
llvm-svn: 166257
2012-10-19Describe the new input-files block and its record, for llvm-bcanalyzer.Douglas Gregor1-0/+3
llvm-svn: 166252
2012-10-19Move the set of files to be validated in an AST file into the controlDouglas Gregor3-126/+190
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
2012-10-18Move OriginalDir from ASTReader to ModuleFile.Douglas Gregor1-18/+13
llvm-svn: 166233
2012-10-18Move the "RelocatablePCH" bit from the ASTReader to the module file.Douglas Gregor1-9/+9
llvm-svn: 166229
2012-10-18Move information about the "original file" from the ASTReader into theDouglas Gregor1-17/+21
module files. llvm-svn: 166228
2012-10-18From Vassil Vassilev: enable Sema to deal with multiple ExternalSemaSources.Axel Naumann1-1/+1
llvm-svn: 166208
2012-10-18Collapse the original file name and original file ID records into aDouglas Gregor2-19/+9
single record. llvm-svn: 166206
2012-10-18Collapse the "version control revision/tag" AST file record into theDouglas Gregor2-33/+35
metadata record, which already had other version information. Clean up the block info block along the way. llvm-svn: 166204
2012-10-18Split the target options out into their own record within the ASTDouglas Gregor2-31/+39
file's control block. llvm-svn: 166195
2012-10-18DR1442: In a range-based for statement, namespace 'std' is not an associatedRichard Smith2-4/+0
namespace. llvm-svn: 166194
2012-10-18Start factoring the on-disk records for an AST file into a controlDouglas Gregor2-155/+230
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
2012-10-17Set a special flag in class metadata when an Objective-C classJohn McCall2-0/+4
has ivars that require destruction, but none that require anything except zero-initialization. This is common in ARC and (when true throughout a class hierarchy) permits the elimination of an unnecessary message-send during allocation. llvm-svn: 166088
2012-10-16Serialize TargetOptions into an AST file, and make sure that we keepDouglas Gregor2-23/+92
target options around so they can be accessed at any point (rather than keeping them transient). llvm-svn: 166072
2012-10-15Introduce the notion of excluded headers into the module mapDouglas Gregor2-1/+33
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
2012-10-12[PCH] We only need to record C++ overridden methods once for the canonical decl.Argyrios Kyrtzidis1-5/+10
llvm-svn: 165788
2012-10-12Track which particular submodule #undef's a macro, so that the actualDouglas Gregor2-10/+49
#undef only occurs if that submodule is imported. llvm-svn: 165773