[cfe-commits] r83153 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp lib/Sema/SemaOverload.cpp test/SemaCXX/overloaded-operator.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Sep 30 10:46:21 PDT 2009
Author: fjahanian
Date: Wed Sep 30 12:46:20 2009
New Revision: 83153
URL: http://llvm.org/viewvc/llvm-project?rev=83153&view=rev
Log:
Note location of operators caused the circularity.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/overloaded-operator.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=83153&r1=83152&r2=83153&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Sep 30 12:46:20 2009
@@ -1979,6 +1979,7 @@
if (OpKind == tok::arrow) {
// The set of types we've considered so far.
llvm::SmallPtrSet<CanQualType,8> CTypes;
+ llvm::SmallVector<SourceLocation, 8> Locations;
CTypes.insert(Context.getCanonicalType(BaseType));
while (BaseType->isRecordType()) {
@@ -1986,11 +1987,14 @@
BaseExpr = (Expr*)Base.get();
if (BaseExpr == NULL)
return ExprError();
+ if (CXXOperatorCallExpr *OpCall = dyn_cast<CXXOperatorCallExpr>(BaseExpr))
+ Locations.push_back(OpCall->getOperatorLoc());
BaseType = BaseExpr->getType();
CanQualType CBaseType = Context.getCanonicalType(BaseType);
if (!CTypes.insert(CBaseType)) {
- // TODO: note the chain of conversions
Diag(OpLoc, diag::err_operator_arrow_circular);
+ for (unsigned i = 0; i < Locations.size(); i++)
+ Diag(Locations[i], diag::note_declared_at);
return ExprError();
}
}
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=83153&r1=83152&r2=83153&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Sep 30 12:46:20 2009
@@ -5065,7 +5065,7 @@
UsualUnaryConversions(FnExpr);
Base = new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr, &Base, 1,
Method->getResultType().getNonReferenceType(),
- OpLoc);
+ Method->getLocation());
return Owned(Base);
}
Modified: cfe/trunk/test/SemaCXX/overloaded-operator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overloaded-operator.cpp?rev=83153&r1=83152&r2=83153&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overloaded-operator.cpp (original)
+++ cfe/trunk/test/SemaCXX/overloaded-operator.cpp Wed Sep 30 12:46:20 2009
@@ -216,7 +216,7 @@
struct AX {
- AX& operator ->();
+ AX& operator ->(); // expected-note {{declared at}}
int b;
};
@@ -226,14 +226,14 @@
}
struct CircA {
- struct CircB& operator->();
+ struct CircB& operator->(); // expected-note {{declared at}}
int val;
};
struct CircB {
- struct CircC& operator->();
+ struct CircC& operator->(); // expected-note {{declared at}}
};
struct CircC {
- struct CircA& operator->();
+ struct CircA& operator->(); // expected-note {{declared at}}
};
void circ() {
More information about the cfe-commits
mailing list