return getOriginalNamespace();
}
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(getLocation(), RBracLoc);
}
StorageClass SCAsWritten);
virtual SourceLocation getInnerLocStart() const;
- virtual SourceRange getSourceRange() const;
+ SourceRange getSourceRange() const;
StorageClass getStorageClass() const { return (StorageClass)SClass; }
StorageClass getStorageClassAsWritten() const {
const PrintingPolicy &Policy,
bool Qualified) const;
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(getOuterLocStart(), EndRangeLoc);
}
void setLocEnd(SourceLocation E) {
/// getOuterLocStart - Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
SourceLocation getOuterLocStart() const;
- virtual SourceRange getSourceRange() const;
+ SourceRange getSourceRange() const;
TagDecl* getCanonicalDecl();
const TagDecl* getCanonicalDecl() const {
const Capture *end,
bool capturesCXXThis);
- virtual SourceRange getSourceRange() const;
+ SourceRange getSourceRange() const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
public:
/// \brief Source range that this declaration covers.
- virtual SourceRange getSourceRange() const {
- return SourceRange(getLocation(), getLocation());
- }
+ SourceRange getSourceRange() const;
SourceLocation getLocStart() const { return getSourceRange().getBegin(); }
SourceLocation getLocEnd() const { return getSourceRange().getEnd(); }
SourceLocation IdentLoc,
NamedDecl *Namespace);
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(NamespaceLoc, IdentLoc);
}
SourceLocation getLocStart() const { return getLocation(); }
SourceLocation getLocEnd() const { return EndLoc; }
void setEndLoc(SourceLocation Loc) { EndLoc = Loc; }
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(getLocation(), EndLoc);
}
AtEnd = atEnd;
}
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(getLocation(), getAtEndRange().getEnd());
}
const SourceLocation *Locs = 0,
unsigned nElts = 0);
- virtual SourceRange getSourceRange() const;
+ SourceRange getSourceRange() const;
typedef const ObjCClassRef* iterator;
iterator begin() const { return ForwardDecls; }
SourceLocation getCategoryNameLoc() const { return CategoryNameLoc; }
void setCategoryNameLoc(SourceLocation Loc) { CategoryNameLoc = Loc; }
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(AtLoc, getAtEndRange().getEnd());
}
return PropertyIvarDecl;
}
- virtual SourceRange getSourceRange() const {
+ SourceRange getSourceRange() const {
return SourceRange(AtLoc, getLocation());
}
ObjCIvarDecl *ivarDecl,
SourceLocation ivarLoc);
- virtual SourceRange getSourceRange() const;
+ SourceRange getSourceRange() const;
SourceLocation getLocStart() const { return AtLoc; }
void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }
static bool StatSwitch = false;
+namespace {
+ template<typename Class>
+ inline SourceRange getSourceRangeImpl(const Decl *D,
+ SourceRange (Class::*)() const) {
+ return static_cast<const Class *>(D)->getSourceRange();
+ }
+
+ inline SourceRange getSourceRangeImpl(const Decl *D,
+ SourceRange (Decl::*)() const) {
+ return D->getLocation();
+ }
+}
+
+SourceRange Decl::getSourceRange() const {
+ switch (getKind()) {
+#define ABSTRACT_DECL(Type)
+#define DECL(Type, Base) \
+ case Type: return getSourceRangeImpl(this, &Type##Decl::getSourceRange);
+#include "clang/AST/DeclNodes.inc"
+ }
+
+ return getLocation();
+}
+
const char *Decl::getDeclKindName() const {
switch (DeclKind) {
default: assert(0 && "Declaration not in DeclNodes.inc!");
return getSpecificCanonicalDecl(this, &Type##Decl::getCanonicalDecl);
#include "clang/AST/DeclNodes.inc"
}
- return this;
+ return this;
}
//===----------------------------------------------------------------------===//