Fixed TypedefDecl and TemplateTypeParameter source range.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127119 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index bc398f4..4bfb388 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -67,12 +67,14 @@
TInfo = Context.getTrivialTypeSourceInfo(Context.Int128Ty);
PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
SourceLocation(),
+ SourceLocation(),
&Context.Idents.get("__int128_t"),
TInfo), TUScope);
TInfo = Context.getTrivialTypeSourceInfo(Context.UnsignedInt128Ty);
PushOnScopeChains(TypedefDecl::Create(Context, CurContext,
SourceLocation(),
+ SourceLocation(),
&Context.Idents.get("__uint128_t"),
TInfo), TUScope);
Context.setInt128Installed();
@@ -87,7 +89,8 @@
QualType SelT = Context.getPointerType(Context.ObjCBuiltinSelTy);
TypeSourceInfo *SelInfo = Context.getTrivialTypeSourceInfo(SelT);
TypedefDecl *SelTypedef
- = TypedefDecl::Create(Context, CurContext, SourceLocation(),
+ = TypedefDecl::Create(Context, CurContext,
+ SourceLocation(), SourceLocation(),
&Context.Idents.get("SEL"), SelInfo);
PushOnScopeChains(SelTypedef, TUScope);
Context.setObjCSelType(Context.getTypeDeclType(SelTypedef));
@@ -109,7 +112,8 @@
T = Context.getObjCObjectPointerType(T);
TypeSourceInfo *IdInfo = Context.getTrivialTypeSourceInfo(T);
TypedefDecl *IdTypedef
- = TypedefDecl::Create(Context, CurContext, SourceLocation(),
+ = TypedefDecl::Create(Context, CurContext,
+ SourceLocation(), SourceLocation(),
&Context.Idents.get("id"), IdInfo);
PushOnScopeChains(IdTypedef, TUScope);
Context.setObjCIdType(Context.getTypeDeclType(IdTypedef));
@@ -121,7 +125,8 @@
T = Context.getObjCObjectPointerType(T);
TypeSourceInfo *ClassInfo = Context.getTrivialTypeSourceInfo(T);
TypedefDecl *ClassTypedef
- = TypedefDecl::Create(Context, CurContext, SourceLocation(),
+ = TypedefDecl::Create(Context, CurContext,
+ SourceLocation(), SourceLocation(),
&Context.Idents.get("Class"), ClassInfo);
PushOnScopeChains(ClassTypedef, TUScope);
Context.setObjCClassType(Context.getTypeDeclType(ClassTypedef));
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index b674cc1..a2f23e8 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5867,6 +5867,7 @@
// Scope manipulation handled by caller.
TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext,
+ D.getSourceRange().getBegin(),
D.getIdentifierLoc(),
D.getIdentifier(),
TInfo);
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 990fc22..e60a1c4 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -525,8 +525,8 @@
TemplateTypeParmDecl *Param
= TemplateTypeParmDecl::Create(Context, Context.getTranslationUnitDecl(),
- Loc, Depth, Position, ParamName, Typename,
- Ellipsis);
+ KeyLoc, Loc, Depth, Position, ParamName,
+ Typename, Ellipsis);
Param->setAccess(AS_public);
if (Invalid)
Param->setInvalidDecl();
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index c30c8a0..c6b4d96 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -3019,7 +3019,8 @@
// Build template<class TemplParam> void Func(FuncParam);
QualType TemplArg = Context.getTemplateTypeParmType(0, 0, false);
- TemplateTypeParmDecl TemplParam(0, Loc, 0, false, TemplArg, false);
+ TemplateTypeParmDecl TemplParam(0, SourceLocation(), Loc, 0, false,
+ TemplArg, false);
NamedDecl *TemplParamPtr = &TemplParam;
FixedSizeTemplateParameterList<1> TemplateParams(Loc, Loc, &TemplParamPtr,
Loc);
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index b668e17..0650e45 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -145,8 +145,8 @@
// Create the new typedef
TypedefDecl *Typedef
- = TypedefDecl::Create(SemaRef.Context, Owner, D->getLocation(),
- D->getIdentifier(), DI);
+ = TypedefDecl::Create(SemaRef.Context, Owner, D->getLocStart(),
+ D->getLocation(), D->getIdentifier(), DI);
if (Invalid)
Typedef->setInvalidDecl();
@@ -1450,7 +1450,8 @@
const TemplateTypeParmType *TTPT = T->getAs<TemplateTypeParmType>();
TemplateTypeParmDecl *Inst =
- TemplateTypeParmDecl::Create(SemaRef.Context, Owner, D->getLocation(),
+ TemplateTypeParmDecl::Create(SemaRef.Context, Owner,
+ D->getLocStart(), D->getLocation(),
TTPT->getDepth() - TemplateArgs.getNumLevels(),
TTPT->getIndex(), D->getIdentifier(),
D->wasDeclaredWithTypename(),