only extract main if the user didn't specify anything to extract
[oota-llvm.git] / tools / llvm-extract / llvm-extract.cpp
index 1950f53972baada20717bac39bda3c8b8837b933..360630b41dc049013915707fb2748ddcbde0d690 100644 (file)
@@ -81,7 +81,7 @@ int main(int argc, char **argv) {
     M.get()->getNamedGlobal(ExtractGlobal) : 0;
 
   // Figure out which function we should extract
-  if (!ExtractFunc.size()) ExtractFunc = "main";
+  if (!ExtractFunc.size() && !ExtractGlobal.size()) ExtractFunc = "main";
   Function *F = M.get()->getFunction(ExtractFunc);
 
   if (F == 0 && G == 0) {