aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaTemplate.cpp6
-rw-r--r--lib/Sema/SemaType.cpp14
-rw-r--r--lib/Sema/TreeTransform.h6
3 files changed, 15 insertions, 11 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 2d2c3ea672..78f8d5e05a 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -5901,7 +5901,8 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
if (InnerTSI)
Builder.pushFullCopy(InnerTSI->getTypeLoc());
else
- Builder.push<TemplateSpecializationTypeLoc>(T).initialize(TemplateLoc);
+ Builder.push<TemplateSpecializationTypeLoc>(T).initialize(Context,
+ TemplateLoc);
/* Note: NNS already embedded in template specialization type T. */
T = Context.getElaboratedType(ETK_Typename, /*NNS=*/0, T);
@@ -5937,7 +5938,8 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
for (unsigned I = 0, E = TST->getNumArgs(); I != E; ++I)
TL.setArgLocInfo(I, TSTL.getArgLocInfo(I));
} else {
- TL.initializeLocal(SourceLocation());
+ // FIXME: Poor source-location information here.
+ TL.initializeLocal(Context, TemplateLoc);
}
TL.setKeywordLoc(TypenameLoc);
TL.setQualifierRange(SS.getRange());
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 40d3734836..c8f7545602 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1972,10 +1972,12 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
namespace {
class TypeSpecLocFiller : public TypeLocVisitor<TypeSpecLocFiller> {
+ ASTContext &Context;
const DeclSpec &DS;
public:
- TypeSpecLocFiller(const DeclSpec &DS) : DS(DS) {}
+ TypeSpecLocFiller(ASTContext &Context, const DeclSpec &DS)
+ : Context(Context), DS(DS) {}
void VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
Visit(TL.getUnqualifiedLoc());
@@ -1990,7 +1992,7 @@ namespace {
// Handle the base type, which might not have been written explicitly.
if (DS.getTypeSpecType() == DeclSpec::TST_unspecified) {
TL.setHasBaseTypeAsWritten(false);
- TL.getBaseLoc().initialize(SourceLocation());
+ TL.getBaseLoc().initialize(Context, SourceLocation());
} else {
TL.setHasBaseTypeAsWritten(true);
Visit(TL.getBaseLoc());
@@ -2021,7 +2023,7 @@ namespace {
// If we got no declarator info from previous Sema routines,
// just fill with the typespec loc.
if (!TInfo) {
- TL.initialize(DS.getTypeSpecTypeLoc());
+ TL.initialize(Context, DS.getTypeSpecTypeLoc());
return;
}
@@ -2114,7 +2116,7 @@ namespace {
return;
}
}
- TL.initializeLocal(SourceLocation());
+ TL.initializeLocal(Context, SourceLocation());
TL.setKeywordLoc(Keyword != ETK_None
? DS.getTypeSpecTypeLoc()
: SourceLocation());
@@ -2126,7 +2128,7 @@ namespace {
void VisitTypeLoc(TypeLoc TL) {
// FIXME: add other typespec types and change this to an assert.
- TL.initialize(DS.getTypeSpecTypeLoc());
+ TL.initialize(Context, DS.getTypeSpecTypeLoc());
}
};
@@ -2231,7 +2233,7 @@ Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T,
assert(TL.getFullDataSize() == CurrTL.getFullDataSize());
memcpy(CurrTL.getOpaqueData(), TL.getOpaqueData(), TL.getFullDataSize());
} else {
- TypeSpecLocFiller(D.getDeclSpec()).Visit(CurrTL);
+ TypeSpecLocFiller(Context, D.getDeclSpec()).Visit(CurrTL);
}
return TInfo;
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 654bf90e87..04c45b8da7 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -2980,8 +2980,8 @@ QualType TreeTransform<Derived>::TransformType(QualType T) {
// Temporary workaround. All of these transformations should
// eventually turn into transformations on TypeLocs.
- TypeSourceInfo *DI = getSema().Context.CreateTypeSourceInfo(T);
- DI->getTypeLoc().initialize(getDerived().getBaseLocation());
+ TypeSourceInfo *DI = getSema().Context.getTrivialTypeSourceInfo(T,
+ getDerived().getBaseLocation());
TypeSourceInfo *NewDI = getDerived().TransformType(DI);
@@ -3073,7 +3073,7 @@ TreeTransform<Derived>::TransformTypeInObjectScope(QualType T,
return T;
TypeSourceInfo *TSI =
- SemaRef.Context.getTrivialTypeSourceInfo(T, getBaseLocation());
+ SemaRef.Context.getTrivialTypeSourceInfo(T, getDerived().getBaseLocation());
TSI = getDerived().TransformTypeInObjectScope(TSI, ObjectType,
UnqualLookup, Prefix);