[cfe-commits] r70663 - /cfe/trunk/lib/Sema/SemaStmt.cpp

Chris Lattner sabre at nondot.org
Sat May 2 22:59:17 PDT 2009


Author: lattner
Date: Sun May  3 00:59:17 2009
New Revision: 70663

URL: http://llvm.org/viewvc/llvm-project?rev=70663&view=rev
Log:
rename some variables, improve comments.

Modified:
    cfe/trunk/lib/Sema/SemaStmt.cpp

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=70663&r1=70662&r2=70663&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sun May  3 00:59:17 2009
@@ -1041,22 +1041,25 @@
     unsigned TiedTo = Info.getTiedOperand();
     Expr *OutputExpr     = Exprs[TiedTo];
     ParenExpr *InputExpr = cast<ParenExpr>(Exprs[i+NumOutputs]);
-    QualType T1 = OutputExpr->getType();
-    QualType T2 = InputExpr->getType();
-    if (Context.hasSameType(T1, T2))
+    QualType InTy = InputExpr->getType();
+    QualType OutTy = OutputExpr->getType();
+    if (Context.hasSameType(InTy, OutTy))
       continue;  // All types can be tied to themselves.
     
-    
-    // Int/ptr operands are ok if they are the same size.
-    if ((T1->isIntegerType() || T1->isPointerType()) &&
-        (T2->isIntegerType() || T2->isPointerType())) {
-      if (Context.getTypeSize(T1) == Context.getTypeSize(T2))
+    // Int/ptr operands have some special cases that we allow.
+    if ((OutTy->isIntegerType() || OutTy->isPointerType()) &&
+        (InTy->isIntegerType() || InTy->isPointerType())) {
+      
+      // They are ok if they are the same size.  Tying void* to int is ok if
+      // they are the same size, for example.  This also allows tying void* to
+      // int*.
+      if (Context.getTypeSize(OutTy) == Context.getTypeSize(InTy))
         continue;
     }
     
     Diag(InputExpr->getSubExpr()->getLocStart(),
          diag::err_asm_tying_incompatible_types)
-      << T2 << T1 << OutputExpr->getSourceRange()
+      << InTy << OutTy << OutputExpr->getSourceRange()
       << InputExpr->getSourceRange();
     DeleteStmt(NS);
     return StmtError();





More information about the cfe-commits mailing list