[clang-scan-deps] Add -M to work around -MT issue after r371918
authorFangrui Song <maskray@google.com>
Sat, 14 Sep 2019 07:25:27 +0000 (07:25 +0000)
committerFangrui Song <maskray@google.com>
Sat, 14 Sep 2019 07:25:27 +0000 (07:25 +0000)
gcc will complain if -MT is used but neither -M nor -MM is specified:

> cc1: error: to generate dependencies you must specify either -M or -MM

r371918 changed our behavior to match GCC, but apparently
clang-scan-deps is not happy.

llvm-svn: 371920

clang/tools/clang-scan-deps/ClangScanDeps.cpp

index 4bd61fb..6e8d9a9 100644 (file)
@@ -242,6 +242,7 @@ int main(int argc, const char **argv) {
         AdjustedArgs.push_back("-o");
         AdjustedArgs.push_back("/dev/null");
         if (!HasMT && !HasMQ) {
+          AdjustedArgs.push_back("-M");
           AdjustedArgs.push_back("-MT");
           // We're interested in source dependencies of an object file.
           if (!HasMD) {