[llvm-install-name-tool] Quote passed rpath args in error messages
This diff refactors error reporting to make it more clear
what arguments were passed to llvm-install-name-tool.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D90080
diff --git a/llvm/tools/llvm-objcopy/CopyConfig.cpp b/llvm/tools/llvm-objcopy/CopyConfig.cpp
index 1bab7cd..ba74759 100644
--- a/llvm/tools/llvm-objcopy/CopyConfig.cpp
+++ b/llvm/tools/llvm-objcopy/CopyConfig.cpp
@@ -905,12 +905,12 @@
if (is_contained(Config.RPathToAdd, RPath))
return createStringError(
errc::invalid_argument,
- "cannot specify both -add_rpath %s and -delete_rpath %s",
+ "cannot specify both -add_rpath '%s' and -delete_rpath '%s'",
RPath.str().c_str(), RPath.str().c_str());
if (is_contained(Config.RPathToPrepend, RPath))
return createStringError(
errc::invalid_argument,
- "cannot specify both -prepend_rpath %s and -delete_rpath %s",
+ "cannot specify both -prepend_rpath '%s' and -delete_rpath '%s'",
RPath.str().c_str(), RPath.str().c_str());
Config.RPathsToRemove.insert(RPath);
@@ -930,30 +930,30 @@
});
if (It1 != Config.RPathsToUpdate.end())
return createStringError(errc::invalid_argument,
- "cannot specify both -rpath " + It1->getFirst() +
- " " + It1->getSecond() + " and -rpath " +
- Old + " " + New);
+ "cannot specify both -rpath '" +
+ It1->getFirst() + "' '" + It1->getSecond() +
+ "' and -rpath '" + Old + "' '" + New + "'");
// Cannot specify the same rpath under both -delete_rpath and -rpath
auto It2 = find_if(Config.RPathsToRemove, Match);
if (It2 != Config.RPathsToRemove.end())
return createStringError(errc::invalid_argument,
- "cannot specify both -delete_rpath " + *It2 +
- " and -rpath " + Old + " " + New);
+ "cannot specify both -delete_rpath '" + *It2 +
+ "' and -rpath '" + Old + "' '" + New + "'");
// Cannot specify the same rpath under both -add_rpath and -rpath
auto It3 = find_if(Config.RPathToAdd, Match);
if (It3 != Config.RPathToAdd.end())
return createStringError(errc::invalid_argument,
- "cannot specify both -add_rpath " + *It3 +
- " and -rpath " + Old + " " + New);
+ "cannot specify both -add_rpath '" + *It3 +
+ "' and -rpath '" + Old + "' '" + New + "'");
// Cannot specify the same rpath under both -prepend_rpath and -rpath.
auto It4 = find_if(Config.RPathToPrepend, Match);
if (It4 != Config.RPathToPrepend.end())
return createStringError(errc::invalid_argument,
- "cannot specify both -prepend_rpath " + *It4 +
- " and -rpath " + Old + " " + New);
+ "cannot specify both -prepend_rpath '" + *It4 +
+ "' and -rpath '" + Old + "' '" + New + "'");
Config.RPathsToUpdate.insert({Old, New});
}