r177768 - Use RequireCompleteType() instead of isIncompleteType().

Bill Wendling isanbard at gmail.com
Fri Mar 22 14:33:46 PDT 2013


Author: void
Date: Fri Mar 22 16:33:46 2013
New Revision: 177768

URL: http://llvm.org/viewvc/llvm-project?rev=177768&view=rev
Log:
Use RequireCompleteType() instead of isIncompleteType().

isIncompleteType() returns true or false for template types depending on whether
the type is instantiated yet. In this context, that's arbitrary. The better way
to check for a complete type is RequireCompleteType().

Thanks to Eli Friedman for noticing this!

<rdar://problem/12700799>

Modified:
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp
    cfe/trunk/test/CodeGen/x86_32-inline-asm.c

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=177768&r1=177767&r2=177768&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Fri Mar 22 16:33:46 2013
@@ -181,7 +181,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL
     InputConstraintInfos.push_back(Info);
 
     const Type *Ty = Exprs[i]->getType().getTypePtr();
-    if (Ty->isDependentType() || Ty->isIncompleteType())
+    if (Ty->isDependentType() ||
+        RequireCompleteType(InputExpr->getLocStart(),
+                            Exprs[i]->getType(), 0))
       continue;
 
     unsigned Size = Context.getTypeSize(Ty);

Modified: cfe/trunk/test/CodeGen/x86_32-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-inline-asm.c?rev=177768&r1=177767&r2=177768&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-inline-asm.c Fri Mar 22 16:33:46 2013
@@ -7,7 +7,7 @@ typedef u_int32_t uint32_t;
 typedef unsigned long long u_int64_t;
 typedef u_int64_t uint64_t;
 
-int func() {
+int func1() {
   // Error out if size is > 32-bits.
   uint32_t msr = 0x8b;
   uint64_t val = 0;
@@ -22,3 +22,10 @@ int func() {
   unsigned int port;
   __asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected.
 }
+
+struct S;
+void func2(struct S *s) {
+  __asm__ volatile(""
+                   :
+                   : "a" (*s));
+}





More information about the cfe-commits mailing list