Change TargetInfo::validateInputConstraint to take begin/end name iterators instead of the number of outputs. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62433 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index a8eed16..c46ae77 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -944,6 +944,16 @@
   const_outputs_iterator begin_outputs() const { return &Exprs[0]; }
   const_outputs_iterator end_outputs() const { return &Exprs[0] + NumOutputs; }
   
+  // Input name iterator.
+  
+  const std::string *begin_output_names() const {
+    return &Names[0];
+  }
+  
+  const std::string *end_output_names() const {
+    return &Names[0] + NumOutputs;
+  }
+  
   // Child iterators  
   
   virtual child_iterator child_begin();
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index a9a7136..ce7f7da 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -198,8 +198,10 @@
   // a constraint is valid and provides information about it.
   // FIXME: These should return a real error instead of just true/false.
   bool validateOutputConstraint(const char *Name, ConstraintInfo &Info) const;
-  bool validateInputConstraint (const char *Name, unsigned NumOutputs,
-                                ConstraintInfo &info) const;
+  bool validateInputConstraint(const char *Name, 
+                               const std::string *OutputNamesBegin,
+                               const std::string *OutputNamesEnd,
+                               ConstraintInfo &info) const;
 
   virtual std::string convertConstraint(const char Constraint) const {
     return std::string(1, Constraint);
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 05004b7..89bc8b4 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -188,7 +188,8 @@
 }
 
 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 @@
     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/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index edccbe4..d86c3f4 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -977,7 +977,9 @@
     
     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/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 7a41f4d..cb467d4 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -897,7 +897,8 @@
     
     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;