[PATCH] D49100: Avoid returning an invalid end source loc
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 24 13:40:36 PDT 2018
steveire updated this revision to Diff 157116.
steveire retitled this revision from "Inline DeclarationNameInfo::getLocEnd into callers" to "Avoid returning an invalid end source loc".
steveire edited the summary of this revision.
Repository:
rC Clang
https://reviews.llvm.org/D49100
Files:
include/clang/AST/DeclarationName.h
lib/AST/DeclarationName.cpp
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:
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49100.157116.patch
Type: text/x-patch
Size: 1402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180724/13676e02/attachment-0001.bin>
More information about the cfe-commits
mailing list