Remove ".bc" from the end of InputFile if it is there, in
authorBrian Gaeke <gaeke@uiuc.edu>
Fri, 23 May 2003 20:28:07 +0000 (20:28 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Fri, 23 May 2003 20:28:07 +0000 (20:28 +0000)
tools/lli/lli.cpp:main().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6317 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/lli.cpp

index 30b65997d67d89d18209458e408aa3e5f1157301..a69f53c98a720a15e1e028d6790dc3d49091f38f 100644 (file)
@@ -88,6 +88,13 @@ int main(int argc, char** argv) {
     EE = ExecutionEngine::createInterpreter(M, Config, DebugMode, TraceMode);
 
   // Add the module name to the start of the argv vector...
+  // But delete .bc first, since programs (and users) might not expect to
+  // see it.
+  const std::string ByteCodeFileSuffix (".bc");
+  if (InputFile.rfind (ByteCodeFileSuffix) ==
+      InputFile.length () - ByteCodeFileSuffix.length ()) {
+    InputFile.erase (InputFile.length () - ByteCodeFileSuffix.length ());
+  }
   InputArgv.insert(InputArgv.begin(), InputFile);
 
   // Run the main function!