summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-10-29 08:12:44 +0000
committerJohn McCall <rjmccall@apple.com>2009-10-29 08:12:44 +0000
commit0ad166672f581c4a8ed5f4c0329c856820e10bd4 (patch)
tree0f937f8222c080e903277cb84f9888d218237b4a /clang/lib/Frontend/PCHWriter.cpp
parent588d2d585d1bafe4cffe9ce2b8d41965c42001c3 (diff)
downloadbcm5719-llvm-0ad166672f581c4a8ed5f4c0329c856820e10bd4.tar.gz
bcm5719-llvm-0ad166672f581c4a8ed5f4c0329c856820e10bd4.zip
Track source information for template arguments and template specialization
types. Preserve it through template instantiation. Preserve it through PCH, although TSTs themselves aren't serializable, so that's pretty much meaningless. llvm-svn: 85500
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 4c733db1a01..de56166125e 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -368,7 +368,11 @@ void TypeLocWriter::VisitSubstTemplateTypeParmTypeLoc(
}
void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
TemplateSpecializationTypeLoc TL) {
- Writer.AddSourceLocation(TL.getNameLoc(), Record);
+ Writer.AddSourceLocation(TL.getTemplateNameLoc(), Record);
+ Writer.AddSourceLocation(TL.getLAngleLoc(), Record);
+ Writer.AddSourceLocation(TL.getRAngleLoc(), Record);
+ for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
+ Writer.AddTemplateArgumentLoc(TL.getArgLoc(i), Record);
}
void TypeLocWriter::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record);
@@ -2105,6 +2109,23 @@ void PCHWriter::AddSelectorRef(const Selector SelRef, RecordData &Record) {
Record.push_back(SID);
}
+void PCHWriter::AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg,
+ RecordData &Record) {
+ switch (Arg.getArgument().getKind()) {
+ case TemplateArgument::Expression:
+ AddStmt(Arg.getLocInfo().getAsExpr());
+ break;
+ case TemplateArgument::Type:
+ AddDeclaratorInfo(Arg.getLocInfo().getAsDeclaratorInfo(), Record);
+ break;
+ case TemplateArgument::Null:
+ case TemplateArgument::Integral:
+ case TemplateArgument::Declaration:
+ case TemplateArgument::Pack:
+ break;
+ }
+}
+
void PCHWriter::AddDeclaratorInfo(DeclaratorInfo *DInfo, RecordData &Record) {
if (DInfo == 0) {
AddTypeRef(QualType(), Record);
OpenPOWER on IntegriCloud