diff options
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h')
-rw-r--r-- | contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h b/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h index 2170f2b..6349d9c 100644 --- a/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h +++ b/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h @@ -17,6 +17,7 @@ #include "clang/AST/Type.h" #include "clang/AST/CanonicalType.h" #include "clang/Basic/PartialDiagnostic.h" +#include "llvm/Support/Compiler.h" namespace llvm { template <typename T> struct DenseMapInfo; @@ -510,8 +511,17 @@ public: /// getEndLoc - Retrieve the location of the last token. SourceLocation getEndLoc() const; /// getSourceRange - The range of the declaration name. - SourceRange getSourceRange() const { - return SourceRange(getBeginLoc(), getEndLoc()); + SourceRange getSourceRange() const LLVM_READONLY { + SourceLocation BeginLoc = getBeginLoc(); + SourceLocation EndLoc = getEndLoc(); + return SourceRange(BeginLoc, EndLoc.isValid() ? EndLoc : BeginLoc); + } + SourceLocation getLocStart() const LLVM_READONLY { + return getBeginLoc(); + } + SourceLocation getLocEnd() const LLVM_READONLY { + SourceLocation EndLoc = getEndLoc(); + return EndLoc.isValid() ? EndLoc : getLocStart(); } }; |