aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-05 10:37:55 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-05 10:37:55 +0000
commit7b081c8604efd33bc7f7e5c1e9427a031eedb2b4 (patch)
tree432afa70c3fdd9e861f010a5e129464b69e191d6 /lib
parentb7e3aabf8f0fe4210d6a0aaec8a2b5770cab9186 (diff)
Read/write some source location for PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/Decl.cpp9
-rw-r--r--lib/Frontend/PCHReaderDecl.cpp6
-rw-r--r--lib/Frontend/PCHWriterDecl.cpp4
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index c3c30f9446..6fa6745870 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -1352,7 +1352,8 @@ FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs,
void *InsertPos,
TemplateSpecializationKind TSK,
- const TemplateArgumentListInfo *TemplateArgsAsWritten) {
+ const TemplateArgumentListInfo *TemplateArgsAsWritten,
+ SourceLocation PointOfInstantiation) {
assert(TSK != TSK_Undeclared &&
"Must specify the type of function template specialization");
FunctionTemplateSpecializationInfo *Info
@@ -1365,6 +1366,7 @@ FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
Info->Template.setInt(TSK - 1);
Info->TemplateArguments = TemplateArgs;
Info->TemplateArgumentsAsWritten = TemplateArgsAsWritten;
+ Info->PointOfInstantiation = PointOfInstantiation;
TemplateOrSpecialization = Info;
// Insert this function template specialization into the set of known
@@ -1391,7 +1393,8 @@ FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
unsigned NumTemplateArgsAsWritten,
TemplateArgumentLoc *TemplateArgsAsWritten,
SourceLocation LAngleLoc,
- SourceLocation RAngleLoc) {
+ SourceLocation RAngleLoc,
+ SourceLocation PointOfInstantiation) {
ASTContext &Ctx = getASTContext();
TemplateArgumentList *TemplArgs
= new (Ctx) TemplateArgumentList(Ctx, TemplateArgs, NumTemplateArgs);
@@ -1401,7 +1404,7 @@ FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
TemplArgsInfo->addArgument(TemplateArgsAsWritten[i]);
setFunctionTemplateSpecialization(Template, TemplArgs, /*InsertPos=*/0, TSK,
- TemplArgsInfo);
+ TemplArgsInfo, PointOfInstantiation);
}
void
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index be4f72ec3b..1a1f23fc49 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -248,12 +248,14 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
LAngleLoc = Reader.ReadSourceLocation(Record, Idx);
RAngleLoc = Reader.ReadSourceLocation(Record, Idx);
}
+
+ SourceLocation POI = Reader.ReadSourceLocation(Record, Idx);
FD->setFunctionTemplateSpecialization(Template, TemplArgs.size(),
TemplArgs.data(), TSK,
TemplArgLocs.size(),
TemplArgLocs.data(),
- LAngleLoc, RAngleLoc);
+ LAngleLoc, RAngleLoc, POI);
break;
}
case FunctionDecl::TK_DependentFunctionTemplateSpecialization: {
@@ -268,6 +270,8 @@ void PCHDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
unsigned NumArgs = Record[Idx++];
while (NumArgs--)
TemplArgs.addArgument(Reader.ReadTemplateArgumentLoc(Record, Idx));
+ TemplArgs.setLAngleLoc(Reader.ReadSourceLocation(Record, Idx));
+ TemplArgs.setRAngleLoc(Reader.ReadSourceLocation(Record, Idx));
FD->setDependentTemplateSpecialization(*Reader.getContext(),
TemplDecls, TemplArgs);
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp
index deca4b22ec..9f7264ede1 100644
--- a/lib/Frontend/PCHWriterDecl.cpp
+++ b/lib/Frontend/PCHWriterDecl.cpp
@@ -249,6 +249,8 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
Writer.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->getRAngleLoc(),
Record);
}
+
+ Writer.AddSourceLocation(FTSInfo->getPointOfInstantiation(), Record);
break;
}
case FunctionDecl::TK_DependentFunctionTemplateSpecialization: {
@@ -264,6 +266,8 @@ void PCHDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
Record.push_back(DFTSInfo->getNumTemplateArgs());
for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
Writer.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i), Record);
+ Writer.AddSourceLocation(DFTSInfo->getLAngleLoc(), Record);
+ Writer.AddSourceLocation(DFTSInfo->getRAngleLoc(), Record);
break;
}
}