test case? On Mon, Jul 30, 2018 at 1:39 PM Stephen Kelly via cfe-commits < cfe-commits@lists.llvm.org> wrote:
> Author: steveire > Date: Mon Jul 30 13:39:14 2018 > New Revision: 338301 > > URL: http://llvm.org/viewvc/llvm-project?rev=338301&view=rev > Log: > Avoid returning an invalid end source loc > > Modified: > cfe/trunk/include/clang/AST/DeclarationName.h > cfe/trunk/lib/AST/DeclarationName.cpp > > Modified: cfe/trunk/include/clang/AST/DeclarationName.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclarationName.h?rev=338301&r1=338300&r2=338301&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclarationName.h (original) > +++ cfe/trunk/include/clang/AST/DeclarationName.h Mon Jul 30 13:39:14 2018 > @@ -558,7 +558,7 @@ public: > 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 @@ public: > } > > 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 > > Modified: cfe/trunk/lib/AST/DeclarationName.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=338301&r1=338300&r2=338301&view=diff > > ============================================================================== > --- cfe/trunk/lib/AST/DeclarationName.cpp (original) > +++ cfe/trunk/lib/AST/DeclarationName.cpp Mon Jul 30 13:39:14 2018 > @@ -689,7 +689,7 @@ void DeclarationNameInfo::printName(raw_ > llvm_unreachable("Unexpected declaration name kind"); > } > > -SourceLocation DeclarationNameInfo::getEndLoc() const { > +SourceLocation DeclarationNameInfo::getEndLocPrivate() const { > switch (Name.getNameKind()) { > case DeclarationName::Identifier: > case DeclarationName::CXXDeductionGuideName: > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits