Simplify by using startswith instead of substr.
authorChris Lattner <sabre@nondot.org>
Mon, 10 May 2010 20:58:42 +0000 (20:58 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 10 May 2010 20:58:42 +0000 (20:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103430 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 6ad427218d7b79592b77be09309d60bb84cc16f4..819a5cba72903e5c8fa7f7c99c28e7d931ecaaa9 100644 (file)
@@ -1152,7 +1152,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
     Assert1(CS.arg_size() == FTy->getNumParams(),
             "Incorrect number of arguments passed to called function!", I);
 
-  // Verify that all arguments to the call match the function type...
+  // Verify that all arguments to the call match the function type.
   for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
     Assert3(CS.getArgument(i)->getType() == FTy->getParamType(i),
             "Call parameter type does not match function signature!",
@@ -1180,7 +1180,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
 
   // Verify that there's no metadata unless it's a direct call to an intrinsic.
   if (!CS.getCalledFunction() || CS.getCalledFunction()->getName().size() < 5 ||
-      CS.getCalledFunction()->getName().substr(0, 5) != "llvm.") {
+      !CS.getCalledFunction()->getName().startswith("llvm.")) {
     for (FunctionType::param_iterator PI = FTy->param_begin(),
            PE = FTy->param_end(); PI != PE; ++PI)
       Assert1(!PI->get()->isMetadataTy(),