Change -Warray-bounds logic to use DiagRuntimeBehavior in preparation for using basic dataflow to suppress warnings on unreachable array bounds checks.

llvm-svn: 126285
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index bb5ef7f..436031b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3135,12 +3135,15 @@
     if (index.slt(size))
       return;
 
-    Diag(E->getBase()->getLocStart(), diag::warn_array_index_exceeds_bounds)
-      << index.toString(10, true) << size.toString(10, true)
-      << IndexExpr->getSourceRange();
+    DiagRuntimeBehavior(E->getBase()->getLocStart(),
+                        PDiag(diag::warn_array_index_exceeds_bounds)
+                        << index.toString(10, true) << size.toString(10, true)
+                        << IndexExpr->getSourceRange());
   } else {
-    Diag(E->getBase()->getLocStart(), diag::warn_array_index_precedes_bounds)
-      << index.toString(10, true) << IndexExpr->getSourceRange();
+    DiagRuntimeBehavior(E->getBase()->getLocStart(),
+                        PDiag(diag::warn_array_index_precedes_bounds)
+                          << index.toString(10, true)
+                          << IndexExpr->getSourceRange());
   }
 
   const NamedDecl *ND = NULL;
@@ -3149,7 +3152,8 @@
   if (const MemberExpr *ME = dyn_cast<MemberExpr>(BaseExpr))
     ND = dyn_cast<NamedDecl>(ME->getMemberDecl());
   if (ND)
-    Diag(ND->getLocStart(), diag::note_array_index_out_of_bounds)
-      << ND->getDeclName();
+    DiagRuntimeBehavior(ND->getLocStart(),
+                        PDiag(diag::note_array_index_out_of_bounds)
+                          << ND->getDeclName());
 }