Index: include/clang/AST/DeclarationName.h =================================================================== --- include/clang/AST/DeclarationName.h +++ include/clang/AST/DeclarationName.h @@ -558,7 +558,7 @@ SourceLocation getBeginLoc() const { return NameLoc; } /// getEndLoc - Retrieve the location of the last token. - SourceLocation getEndLoc() const; + SourceLocation getEndLoc() const { return getLocEnd(); } /// getSourceRange - The range of the declaration name. SourceRange getSourceRange() const LLVM_READONLY { @@ -570,9 +570,11 @@ } SourceLocation getLocEnd() const LLVM_READONLY { - SourceLocation EndLoc = getEndLoc(); + SourceLocation EndLoc = getEndLocPrivate(); return EndLoc.isValid() ? EndLoc : getLocStart(); } +private: + SourceLocation getEndLocPrivate() const; }; /// Insertion operator for diagnostics. This allows sending DeclarationName's Index: lib/AST/DeclarationName.cpp =================================================================== --- lib/AST/DeclarationName.cpp +++ lib/AST/DeclarationName.cpp @@ -689,7 +689,7 @@ llvm_unreachable("Unexpected declaration name kind"); } -SourceLocation DeclarationNameInfo::getEndLoc() const { +SourceLocation DeclarationNameInfo::getEndLocPrivate() const { switch (Name.getNameKind()) { case DeclarationName::Identifier: case DeclarationName::CXXDeductionGuideName: