If called as *cpp or *cpp-[^-]*, run only the preprocessor. If no
input is specified, use stdin implicitly. Based on a patch from
Roman Divacky.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127137 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 0b5d2c9..71baf8d 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -342,6 +342,11 @@
     TheDriver.CCCIsCXX = true;
   }
 
+  if (llvm::StringRef(ProgName).endswith("cpp") ||
+      llvm::StringRef(ProgName).rsplit('-').first.endswith("cpp")) {
+    TheDriver.CCCIsCPP = true;
+  }
+
   // Handle CC_PRINT_OPTIONS and CC_PRINT_OPTIONS_FILE.
   TheDriver.CCPrintOptions = !!::getenv("CC_PRINT_OPTIONS");
   if (TheDriver.CCPrintOptions)