[PATCH] D49100: Inline DeclarationNameInfo::getLocEnd into callers
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 9 14:02:51 PDT 2018
steveire created this revision.
steveire added a reviewer: rsmith.
Herald added a subscriber: cfe-commits.
Note that CXXDependentScopeMemberExpr uses getEndLoc, not getLocEnd,
unlike UnresolvedMemberExpr and UnresolvedLookupExpr (which are changed
by this commit).
Repository:
rC Clang
https://reviews.llvm.org/D49100
Files:
include/clang/AST/DeclarationName.h
include/clang/AST/ExprCXX.h
Index: include/clang/AST/ExprCXX.h
===================================================================
--- include/clang/AST/ExprCXX.h
+++ include/clang/AST/ExprCXX.h
@@ -2828,7 +2828,9 @@
SourceLocation getLocEnd() const LLVM_READONLY {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
- return getNameInfo().getLocEnd();
+ auto nameInfo = getNameInfo();
+ auto endLoc = nameInfo.getEndLoc();
+ return endLoc.isValid() ? endLoc : nameInfo.getBeginLoc();
}
child_range children() {
@@ -3559,7 +3561,10 @@
SourceLocation getLocEnd() const LLVM_READONLY {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
- return getMemberNameInfo().getLocEnd();
+
+ auto nameInfo = getMemberNameInfo();
+ auto endLoc = nameInfo.getEndLoc();
+ return endLoc.isValid() ? endLoc : nameInfo.getBeginLoc();
}
static bool classof(const Stmt *T) {
Index: include/clang/AST/DeclarationName.h
===================================================================
--- include/clang/AST/DeclarationName.h
+++ include/clang/AST/DeclarationName.h
@@ -562,17 +562,13 @@
/// getSourceRange - The range of the declaration name.
SourceRange getSourceRange() const LLVM_READONLY {
- return SourceRange(getLocStart(), getLocEnd());
+ auto EndLoc = getEndLoc();
+ return SourceRange(getLocStart(), EndLoc.isValid() ? EndLoc : getLocStart());
}
SourceLocation getLocStart() const LLVM_READONLY {
return getBeginLoc();
}
-
- SourceLocation getLocEnd() const LLVM_READONLY {
- SourceLocation EndLoc = getEndLoc();
- return EndLoc.isValid() ? EndLoc : getLocStart();
- }
};
/// Insertion operator for diagnostics. This allows sending DeclarationName's
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49100.154693.patch
Type: text/x-patch
Size: 1735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180709/77125ac6/attachment-0001.bin>
More information about the cfe-commits
mailing list