summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-28 16:20:02 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-28 16:20:02 +0000
commitc2fa169d6c8f7975ea9e50c2c1e9dfdbcc071216 (patch)
tree2290758805540d9136ed9d06794152a42e077d8a /clang/lib/Serialization/ASTWriter.cpp
parentd79f9666c8a01c59579aa334229f129e7c5cac29 (diff)
downloadbcm5719-llvm-c2fa169d6c8f7975ea9e50c2c1e9dfdbcc071216.tar.gz
bcm5719-llvm-c2fa169d6c8f7975ea9e50c2c1e9dfdbcc071216.zip
Add support for C++ namespace-aware typo correction, e.g., correcting
vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 80e790c7968..d616c840008 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -781,6 +781,8 @@ void ASTWriter::WriteBlockInfoBlock() {
RECORD(FP_PRAGMA_OPTIONS);
RECORD(OPENCL_EXTENSIONS);
RECORD(DELEGATING_CTORS);
+ RECORD(FILE_SOURCE_LOCATION_OFFSETS);
+ RECORD(KNOWN_NAMESPACES);
// SourceManager Block.
BLOCK(SOURCE_MANAGER_BLOCK);
@@ -2845,6 +2847,16 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
AddDeclRef(Context.getcudaConfigureCallDecl(), CUDASpecialDeclRefs);
}
+ // Build a record containing all of the known namespaces.
+ RecordData KnownNamespaces;
+ for (llvm::DenseMap<NamespaceDecl*, bool>::iterator
+ I = SemaRef.KnownNamespaces.begin(),
+ IEnd = SemaRef.KnownNamespaces.end();
+ I != IEnd; ++I) {
+ if (!I->second)
+ AddDeclRef(I->first, KnownNamespaces);
+ }
+
// Write the remaining AST contents.
RecordData Record;
Stream.EnterSubblock(AST_BLOCK_ID, 5);
@@ -2954,6 +2966,10 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
if (!DelegatingCtorDecls.empty())
Stream.EmitRecord(DELEGATING_CTORS, DelegatingCtorDecls);
+ // Write the known namespaces.
+ if (!KnownNamespaces.empty())
+ Stream.EmitRecord(KNOWN_NAMESPACES, KnownNamespaces);
+
// Some simple statistics
Record.clear();
Record.push_back(NumStatements);
OpenPOWER on IntegriCloud