[cfe-commits] r131170 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/Sema/asm.c
John McCall
rjmccall at apple.com
Tue May 10 16:39:48 PDT 2011
Author: rjmccall
Date: Tue May 10 18:39:47 2011
New Revision: 131170
URL: http://llvm.org/viewvc/llvm-project?rev=131170&view=rev
Log:
Use a heralded conversion to bool in inline-asm constraints.
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/Sema/asm.c
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=131170&r1=131169&r2=131170&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue May 10 18:39:47 2011
@@ -2016,7 +2016,9 @@
if (InputDomain == AD_Int && OutputDomain == AD_Int &&
!isOperandMentioned(InputOpNo, Pieces) &&
InputExpr->isEvaluatable(Context)) {
- InputExpr = ImpCastExprToType(InputExpr, OutTy, CK_IntegralCast).take();
+ CastKind castKind =
+ (OutTy->isBooleanType() ? CK_IntegralToBoolean : CK_IntegralCast);
+ InputExpr = ImpCastExprToType(InputExpr, OutTy, castKind).take();
Exprs[InputOpNo] = InputExpr;
NS->setInputExpr(i, InputExpr);
continue;
Modified: cfe/trunk/test/Sema/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/asm.c?rev=131170&r1=131169&r2=131170&view=diff
==============================================================================
--- cfe/trunk/test/Sema/asm.c (original)
+++ cfe/trunk/test/Sema/asm.c Tue May 10 18:39:47 2011
@@ -105,3 +105,11 @@
register int r asm ("cx");
register int rr asm ("rr_asm"); // expected-error{{unknown register name 'rr_asm' in asm}}
}
+
+// This is just an assert because of the boolean conversion.
+// Feel free to change the assembly to something sensible if it causes a problem.
+// rdar://problem/9414925
+void test11(void) {
+ _Bool b;
+ asm volatile ("movb %%gs:%P2,%b0" : "=q"(b) : "0"(0), "i"(5L));
+}
More information about the cfe-commits
mailing list