[cfe-commits] r117308 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/knr-def-call.c
Douglas Gregor
dgregor at apple.com
Mon Oct 25 13:48:33 PDT 2010
Author: dgregor
Date: Mon Oct 25 15:48:33 2010
New Revision: 117308
URL: http://llvm.org/viewvc/llvm-project?rev=117308&view=rev
Log:
Look through the address-of operator to find the function being
called. Fixes another aspect of PR8314.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/knr-def-call.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=117308&r1=117307&r2=117308&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Oct 25 15:48:33 2010
@@ -3769,6 +3769,10 @@
}
NamedDecl *NDecl = 0;
+ if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn))
+ if (UnOp->getOpcode() == UO_AddrOf)
+ NakedFn = UnOp->getSubExpr()->IgnoreParens();
+
if (isa<DeclRefExpr>(NakedFn))
NDecl = cast<DeclRefExpr>(NakedFn)->getDecl();
Modified: cfe/trunk/test/Sema/knr-def-call.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/knr-def-call.c?rev=117308&r1=117307&r2=117308&view=diff
==============================================================================
--- cfe/trunk/test/Sema/knr-def-call.c (original)
+++ cfe/trunk/test/Sema/knr-def-call.c Mon Oct 25 15:48:33 2010
@@ -37,4 +37,5 @@
void use_proto() {
proto(42.0); // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}}
+ (&proto)(42.0); // expected-warning{{implicit conversion turns floating-point number into integer: 'double' to 'int'}}
}
More information about the cfe-commits
mailing list