summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-26 17:19:08 +0000
committerChris Lattner <sabre@nondot.org>2009-04-26 17:19:08 +0000
commitc3f4c7b1c5e78ba5deb850914681b298567eaeb3 (patch)
tree5c0d4ac4db64024c614bf6ef8574e233f4c6dac0 /clang/lib/Sema/SemaStmt.cpp
parent8d319047c53a3b6cb99ff653dd5a8a39a5663373 (diff)
downloadbcm5719-llvm-c3f4c7b1c5e78ba5deb850914681b298567eaeb3.tar.gz
bcm5719-llvm-c3f4c7b1c5e78ba5deb850914681b298567eaeb3.zip
pull the constraint string into the ConstraintInfo struct
instead of passing it around in addition to it. llvm-svn: 70135
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 62623f37e3e..ed5692c311d 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -922,15 +922,15 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character)
<< Literal->getSourceRange());
- std::string OutputConstraint(Literal->getStrData(),
- Literal->getByteLength());
-
- TargetInfo::ConstraintInfo Info;
- if (!Context.Target.validateOutputConstraint(OutputConstraint.c_str(),Info))
+ TargetInfo::ConstraintInfo Info(Literal->getStrData(),
+ Literal->getByteLength());
+ if (!Context.Target.validateOutputConstraint(Info))
return StmtError(Diag(Literal->getLocStart(),
- diag::err_asm_invalid_output_constraint) << OutputConstraint);
+ diag::err_asm_invalid_output_constraint)
+ << Info.getConstraintStr());
// Check that the output exprs are valid lvalues.
+ // FIXME: Operands to asms should not be parsed as ParenExprs.
ParenExpr *OutputExpr = cast<ParenExpr>(Exprs[i]);
if (CheckAsmLValue(OutputExpr, *this)) {
return StmtError(Diag(OutputExpr->getSubExpr()->getLocStart(),
@@ -947,17 +947,15 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character)
<< Literal->getSourceRange());
- std::string InputConstraint(Literal->getStrData(),
- Literal->getByteLength());
-
- TargetInfo::ConstraintInfo Info;
- if (!Context.Target.validateInputConstraint(InputConstraint.c_str(),
- &Names[0],
+ TargetInfo::ConstraintInfo Info(Literal->getStrData(),
+ Literal->getByteLength());
+ if (!Context.Target.validateInputConstraint(&Names[0],
&Names[0] + NumOutputs,
&OutputConstraintInfos[0],
Info)) {
return StmtError(Diag(Literal->getLocStart(),
- diag::err_asm_invalid_input_constraint) << InputConstraint);
+ diag::err_asm_invalid_input_constraint)
+ << Info.getConstraintStr());
}
ParenExpr *InputExpr = cast<ParenExpr>(Exprs[i]);
@@ -967,14 +965,15 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
if (CheckAsmLValue(InputExpr, *this))
return StmtError(Diag(InputExpr->getSubExpr()->getLocStart(),
diag::err_asm_invalid_lvalue_in_input)
- << InputConstraint << InputExpr->getSubExpr()->getSourceRange());
+ << Info.getConstraintStr()
+ << InputExpr->getSubExpr()->getSourceRange());
}
if (Info.allowsRegister()) {
if (InputExpr->getType()->isVoidType()) {
return StmtError(Diag(InputExpr->getSubExpr()->getLocStart(),
diag::err_asm_invalid_type_in_input)
- << InputExpr->getType() << InputConstraint
+ << InputExpr->getType() << Info.getConstraintStr()
<< InputExpr->getSubExpr()->getSourceRange());
}
}
OpenPOWER on IntegriCloud