[cfe-dev] [patch] Fix source range of overloaded postfix operators and of overloaded operator->
Marcin Kowalczyk
qrczak at google.com
Fri Apr 1 11:54:52 PDT 2011
Without this 'it->first' with 'it' of a class type is claimed to begin
at '->' instead of at 'it', because operator-> gets lumped with prefix
operators.
I believe the arrow should not be included in the end of the range
either, so the whole LHS of such MemberExpr is just 'it', dressed in
an overloaded operator-> call which changes the type.
I spotted a bug in postfix operators while fixing operator->, I assume
it's correct (this one is not tested).
I'm not subscribed.
--- /tmp/g4-89926/cache/depot/google3/third_party/llvm/trunk/tools/clang/lib/AST/ExprCXX.cpp#50
2011-03-16 21:11:57.000000000 +0100
+++ /home/qrczak/qrczak-janitor/google3/third_party/llvm/trunk/tools/clang/lib/AST/ExprCXX.cpp
2011-04-01 19:38:50.805324000 +0200
@@ -368,8 +368,10 @@
getArg(0)->getSourceRange().getEnd());
else
// Postfix operator
- return SourceRange(getArg(0)->getSourceRange().getEnd(),
+ return SourceRange(getArg(0)->getSourceRange().getBegin(),
getOperatorLoc());
+ } else if (Kind == OO_Arrow) {
+ return getArg(0)->getSourceRange();
} else if (Kind == OO_Call) {
return SourceRange(getArg(0)->getSourceRange().getBegin(), getRParenLoc());
} else if (Kind == OO_Subscript) {
--
Marcin Kowalczyk
More information about the cfe-dev
mailing list