aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-03 05:59:17 +0000
committerChris Lattner <sabre@nondot.org>2009-05-03 05:59:17 +0000
commit7adaa18ef3be65971cd41cc61dd739baeb02af10 (patch)
tree79b9c8919b37f82a93fb55abf28f7cc0213467f9 /lib/Sema/SemaStmt.cpp
parent806503f8c839d7f5ebf3fbf7ee848c179be76dd2 (diff)
rename some variables, improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 88c7690f86..ac5cef10f4 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -1041,22 +1041,25 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
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();