================
@@ -327,6 +327,47 @@ void CommandMangler::operator()(tooling::CompileCommand 
&Command,
     return Elem.starts_with("--save-temps") || Elem.starts_with("-save-temps");
   });
 
+  bool GccUnsupportedFlag = false;
+  llvm::erase_if(Cmd, [&](llvm::StringRef FModuleTs) {
+    bool FModuleTSExists = FModuleTs == "-fmodules-ts";
+    GccUnsupportedFlag |= FModuleTSExists;
+    return FModuleTSExists;
+  });
+
+  llvm::erase_if(Cmd, [](llvm::StringRef MnoDirectExternalAccess) {
+    return MnoDirectExternalAccess == "-mno-direct-extern-access";
+  });
+
+  // NOTE: now clang++ cannot understand fdeps* flags, so we remove it this 
time
+  // After clang++ can understand it, remove these lines
+  llvm::erase_if(Cmd, [&](llvm::StringRef FDepFormat) {
+    bool FDepsFormatExists = FDepFormat.starts_with("-fdeps-format=");
+    GccUnsupportedFlag |= FDepsFormatExists;
+    return FDepsFormatExists;
+  });
+
+  llvm::erase_if(Cmd, [&](llvm::StringRef FdepsOutput) {
+    bool FDepsOutputExists =  FdepsOutput.starts_with("-fdeps-output=");
+    GccUnsupportedFlag |= FDepsOutputExists;
+    return FDepsOutputExists;
+  });
+
+  llvm::erase_if(Cmd, [&](llvm::StringRef FdepsTarget) {
+    bool DefTargetExists =  FdepsTarget.starts_with("-fdeps-target=");
+    GccUnsupportedFlag |= DefTargetExists;
+    return DefTargetExists;
+  });
+
+  llvm::erase_if(Cmd, [&](llvm::StringRef Elm) {
+    bool GccMapperExists =  Elm.starts_with("-fmodule-mapper=");
+    GccUnsupportedFlag |= GccMapperExists;
+    return GccMapperExists;
+  });
+
+  if (GccUnsupportedFlag) {
+    log("Warning: detected unsupported gcc Flags. Remove them this time");
----------------
Decodetalkers wrote:

Ok! fixed! Now I log them with the format of "UnsupportedA, UnsupportedB, ..."

https://github.com/llvm/llvm-project/pull/200001
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to