constify array itself, don't iterate multiple times.
authorChris Lattner <sabre@nondot.org>
Fri, 14 Oct 2011 22:50:21 +0000 (22:50 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Oct 2011 22:50:21 +0000 (22:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142013 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Function.cpp

index ef0827b110e41f807d0ce5fe0fb229d24a3ce1f1..1215e6a57ced2034d8728714cf7d007f407e0983 100644 (file)
@@ -417,7 +417,7 @@ bool Function::hasAddressTaken(const User* *PutOffender) const {
 /// FIXME: Remove after <rdar://problem/8031714> is fixed.
 /// FIXME: Is the above FIXME valid?
 bool Function::callsFunctionThatReturnsTwice() const {
-  static const char *ReturnsTwiceFns[] = {
+  static const char *const ReturnsTwiceFns[] = {
     "_setjmp",
     "setjmp",
     "sigsetjmp",
@@ -442,7 +442,7 @@ bool Function::callsFunctionThatReturnsTwice() const {
     if (!F)
       continue;
     StringRef Name = F->getName();
-    for (unsigned J = 0; J < array_lengthof(ReturnsTwiceFns); ++J) {
+    for (unsigned J = 0, e = array_lengthof(ReturnsTwiceFns); J != e; ++J) {
       if (Name == ReturnsTwiceFns[J])
         return true;
     }