/// getInnerLocStart - Return SourceLocation representing start of source
/// range ignoring outer template declarations.
- virtual SourceLocation getInnerLocStart() const { return getLocation(); }
+ SourceLocation getInnerLocStart() const;
/// getOuterLocStart - Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
QualType T, TypeSourceInfo *TInfo, StorageClass S,
StorageClass SCAsWritten);
- virtual SourceLocation getInnerLocStart() const;
SourceRange getSourceRange() const;
StorageClass getStorageClass() const { return (StorageClass)SClass; }
/// getInnerLocStart - Return SourceLocation representing start of source
/// range ignoring outer template declarations.
- virtual SourceLocation getInnerLocStart() const { return TagKeywordLoc; }
+ SourceLocation getInnerLocStart() const;
/// getOuterLocStart - Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
using TemplateParmPosition::setPosition;
using TemplateParmPosition::getIndex;
- SourceLocation getInnerLocStart() const;
SourceRange getSourceRange() const;
/// \brief Determine whether this template parameter has a default
return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
}
- SourceLocation getInnerLocStart() const { return getTemplateKeywordLoc(); }
-
void Profile(llvm::FoldingSetNodeID &ID) const {
Profile(ID, TemplateArgs->data(), TemplateArgs->size(), getASTContext());
}
}
}
+SourceLocation DeclaratorDecl::getInnerLocStart() const {
+ if (const VarDecl *Var = dyn_cast<VarDecl>(this)) {
+ SourceLocation Start = Var->getTypeSpecStartLoc();
+ if (Start.isValid())
+ return Start;
+ } else if (const NonTypeTemplateParmDecl *NTTP
+ = dyn_cast<NonTypeTemplateParmDecl>(this)) {
+ SourceLocation Start = NTTP->getTypeSpecStartLoc();
+ if (Start.isValid())
+ return Start;
+ }
+ return getLocation();
+}
+
SourceLocation DeclaratorDecl::getOuterLocStart() const {
return getTemplateOrInnerLocStart(this);
}
SClass = SC;
}
-SourceLocation VarDecl::getInnerLocStart() const {
- SourceLocation Start = getTypeSpecStartLoc();
- if (Start.isInvalid())
- Start = getLocation();
- return Start;
-}
-
SourceRange VarDecl::getSourceRange() const {
if (getInit())
return SourceRange(getOuterLocStart(), getInit()->getLocEnd());
// TagDecl Implementation
//===----------------------------------------------------------------------===//
+SourceLocation TagDecl::getInnerLocStart() const {
+ if (const ClassTemplateSpecializationDecl *Spec
+ = dyn_cast<ClassTemplateSpecializationDecl>(this)) {
+ SourceLocation Start = Spec->getTemplateKeywordLoc();
+ if (Start.isValid())
+ return Start;
+ }
+
+ return getTagKeywordLoc();
+}
+
SourceLocation TagDecl::getOuterLocStart() const {
return getTemplateOrInnerLocStart(this);
}
ExpandedTInfos);
}
-SourceLocation NonTypeTemplateParmDecl::getInnerLocStart() const {
- SourceLocation Start = getTypeSpecStartLoc();
- if (Start.isInvalid())
- Start = getLocation();
- return Start;
-}
-
SourceRange NonTypeTemplateParmDecl::getSourceRange() const {
return SourceRange(getOuterLocStart(), getLocation());
}