diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-07 21:43:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-07 21:43:38 +0000 |
commit | 6ad9ac097918fbdeb443ea7b99d4db9e49b28534 (patch) | |
tree | 2a0dec1ab33c7ed2fa23ceb391fe4ecd9a3e1ff3 /lib/Frontend/PCHWriter.cpp | |
parent | 3554283157190e67918fad4221a5e6faf9317362 (diff) |
add PCH support for a bunch of C++ Decls, patch by
Andrew Sutton!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103301 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index e56dd31322..225772b30d 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -2181,6 +2181,11 @@ void PCHWriter::AddSourceLocation(SourceLocation Loc, RecordData &Record) { Record.push_back(Loc.getRawEncoding()); } +void PCHWriter::AddSourceRange(SourceRange Range, RecordData &Record) { + AddSourceLocation(Range.getBegin(), Record); + AddSourceLocation(Range.getEnd(), Record); +} + void PCHWriter::AddAPInt(const llvm::APInt &Value, RecordData &Record) { Record.push_back(Value.getBitWidth()); unsigned N = Value.getNumWords(); @@ -2407,3 +2412,42 @@ void PCHWriter::AddDeclarationName(DeclarationName Name, RecordData &Record) { break; } } + +void PCHWriter::AddNestedNameSpecifier(NestedNameSpecifier *NNS, + RecordData &Record) { + // Nested name specifiers usually aren't too long. I think that 8 would + // typically accomodate the vast majority. + llvm::SmallVector<NestedNameSpecifier *, 8> NestedNames; + + // Push each of the NNS's onto a stack for serialization in reverse order. + while (NNS) { + NestedNames.push_back(NNS); + NNS = NNS->getPrefix(); + } + + Record.push_back(NestedNames.size()); + while(!NestedNames.empty()) { + NNS = NestedNames.pop_back_val(); + NestedNameSpecifier::SpecifierKind Kind = NNS->getKind(); + Record.push_back(Kind); + switch (Kind) { + case NestedNameSpecifier::Identifier: + AddIdentifierRef(NNS->getAsIdentifier(), Record); + break; + + case NestedNameSpecifier::Namespace: + AddDeclRef(NNS->getAsNamespace(), Record); + break; + + case NestedNameSpecifier::TypeSpec: + case NestedNameSpecifier::TypeSpecWithTemplate: + AddTypeRef(QualType(NNS->getAsType(), 0), Record); + Record.push_back(Kind == NestedNameSpecifier::TypeSpecWithTemplate); + break; + + case NestedNameSpecifier::Global: + // Don't need to write an associated value. + break; + } + } +} |