[cfe-commits] r94954 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/Sema/indirect-goto.c
Chandler Carruth
chandlerc at gmail.com
Sun Jan 31 02:26:27 PST 2010
Author: chandlerc
Date: Sun Jan 31 04:26:25 2010
New Revision: 94954
URL: http://llvm.org/viewvc/llvm-project?rev=94954&view=rev
Log:
Really trivial patch to accept pointer to const void in indirect goto. Despite
the lack of documentation, this matches the behavior of GCC.
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/Sema/indirect-goto.c
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=94954&r1=94953&r2=94954&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sun Jan 31 04:26:25 2010
@@ -906,10 +906,10 @@
Expr* E = DestExp.takeAs<Expr>();
if (!E->isTypeDependent()) {
QualType ETy = E->getType();
+ QualType DestTy = Context.getPointerType(Context.VoidTy.withConst());
AssignConvertType ConvTy =
- CheckSingleAssignmentConstraints(Context.VoidPtrTy, E);
- if (DiagnoseAssignmentResult(ConvTy, StarLoc, Context.VoidPtrTy, ETy,
- E, AA_Passing))
+ CheckSingleAssignmentConstraints(DestTy, E);
+ if (DiagnoseAssignmentResult(ConvTy, StarLoc, DestTy, ETy, E, AA_Passing))
return StmtError();
}
return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E));
Modified: cfe/trunk/test/Sema/indirect-goto.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/indirect-goto.c?rev=94954&r1=94953&r2=94954&view=diff
==============================================================================
--- cfe/trunk/test/Sema/indirect-goto.c (original)
+++ cfe/trunk/test/Sema/indirect-goto.c Sun Jan 31 04:26:25 2010
@@ -2,6 +2,9 @@
struct c {int x;};
int a(struct c x, long long y) {
+ void const* l1_ptr = &&l1;
+ goto *l1_ptr;
+l1:
goto *x; // expected-error{{incompatible type}}
goto *y; // expected-warning{{incompatible integer to pointer conversion}}
}
More information about the cfe-commits
mailing list