[cfe-commits] r107616 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriterDecl.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Jul 5 03:37:55 PDT 2010
Author: akirtzidis
Date: Mon Jul 5 05:37:55 2010
New Revision: 107616
URL: http://llvm.org/viewvc/llvm-project?rev=107616&view=rev
Log:
Read/write some source location for PCH.
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=107616&r1=107615&r2=107616&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Jul 5 05:37:55 2010
@@ -1508,11 +1508,15 @@
/// \param TSK the kind of template specialization this is.
///
/// \param TemplateArgsAsWritten location info of template arguments.
+ ///
+ /// \param PointOfInstantiation point at which the function template
+ /// specialization was first instantiated.
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs,
void *InsertPos,
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
- const TemplateArgumentListInfo *TemplateArgsAsWritten = 0);
+ const TemplateArgumentListInfo *TemplateArgsAsWritten = 0,
+ SourceLocation PointOfInstantiation = SourceLocation());
/// \brief Specify that this function declaration is actually a function
/// template specialization.
@@ -1537,6 +1541,9 @@
/// \param LAngleLoc location of left angle token.
///
/// \param RAngleLoc location of right angle token.
+ ///
+ /// \param PointOfInstantiation point at which the function template
+ /// specialization was first instantiated.
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
unsigned NumTemplateArgs,
const TemplateArgument *TemplateArgs,
@@ -1544,7 +1551,8 @@
unsigned NumTemplateArgsAsWritten,
TemplateArgumentLoc *TemplateArgsAsWritten,
SourceLocation LAngleLoc,
- SourceLocation RAngleLoc);
+ SourceLocation RAngleLoc,
+ SourceLocation PointOfInstantiation);
/// \brief Specifies that this function declaration is actually a
/// dependent function template specialization.
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=107616&r1=107615&r2=107616&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Jul 5 05:37:55 2010
@@ -1352,7 +1352,8 @@
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 @@
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 @@
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 @@
TemplArgsInfo->addArgument(TemplateArgsAsWritten[i]);
setFunctionTemplateSpecialization(Template, TemplArgs, /*InsertPos=*/0, TSK,
- TemplArgsInfo);
+ TemplArgsInfo, PointOfInstantiation);
}
void
Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=107616&r1=107615&r2=107616&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Mon Jul 5 05:37:55 2010
@@ -248,12 +248,14 @@
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 @@
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);
Modified: cfe/trunk/lib/Frontend/PCHWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriterDecl.cpp?rev=107616&r1=107615&r2=107616&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriterDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriterDecl.cpp Mon Jul 5 05:37:55 2010
@@ -249,6 +249,8 @@
Writer.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->getRAngleLoc(),
Record);
}
+
+ Writer.AddSourceLocation(FTSInfo->getPointOfInstantiation(), Record);
break;
}
case FunctionDecl::TK_DependentFunctionTemplateSpecialization: {
@@ -264,6 +266,8 @@
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;
}
}
More information about the cfe-commits
mailing list