summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/TargetInfo.cpp6
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp4
-rw-r--r--clang/lib/Sema/SemaStmt.cpp3
3 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 05004b73053..89bc8b4c8f9 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -188,7 +188,8 @@ bool TargetInfo::validateOutputConstraint(const char *Name,
}
bool TargetInfo::validateInputConstraint(const char *Name,
- unsigned NumOutputs,
+ const std::string *OutputNamesBegin,
+ const std::string *OutputNamesEnd,
ConstraintInfo &info) const {
info = CI_None;
@@ -197,8 +198,9 @@ bool TargetInfo::validateInputConstraint(const char *Name,
default:
// Check if we have a matching constraint
if (*Name >= '0' && *Name <= '9') {
+ unsigned NumOutputs = OutputNamesEnd - OutputNamesBegin;
unsigned i = *Name - '0';
-
+
// Check if matching constraint is out of bounds.
if (i >= NumOutputs)
return false;
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index edccbe41bfd..d86c3f43891 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -977,7 +977,9 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
TargetInfo::ConstraintInfo Info;
bool result = Target.validateInputConstraint(InputConstraint.c_str(),
- NumConstraints, Info);
+ S.begin_output_names(),
+ S.end_output_names(),
+ Info);
assert(result && "Failed to parse input constraint"); result=result;
if (i != 0 || S.getNumOutputs() > 0)
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 7a41f4d976a..cb467d41d8b 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -897,7 +897,8 @@ Sema::StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
TargetInfo::ConstraintInfo info;
if (!Context.Target.validateInputConstraint(InputConstraint.c_str(),
- NumOutputs, info)) {
+ &Names[0],
+ &Names[0] + NumOutputs, info)) {
// FIXME: We currently leak memory here.
return Diag(Literal->getLocStart(),
diag::err_asm_invalid_input_constraint) << InputConstraint;
OpenPOWER on IntegriCloud