================
@@ -4286,6 +4286,16 @@ void Driver::handleArguments(Compilation &C, 
DerivedArgList &Args,
     YcArg = YuArg = nullptr;
   }
 
+  Arg *IncludePCHArg = Args.getLastArg(options::OPT_include_pch);
+  if (IncludePCHArg && (FinalPhase == phases::Preprocess ||
+                        Args.hasArg(options::OPT_ignore_pch))) {
+    // If only preprocessing or -ignore-pch is used, -include-pch is disabled.
+    // Since -emit-pch is CC1option, it will not be added to command argments 
if
+    // -ignore-pch is used.
+    Args.eraseArg(options::OPT_include_pch);
+    IncludePCHArg = nullptr;
+  }
----------------
mizvekov wrote:

```suggestion
  if (Args.hasArg(options::OPT_include_pch) && (FinalPhase == 
phases::Preprocess ||
                        Args.hasArg(options::OPT_ignore_pch))) {
    // If only preprocessing or -ignore-pch is used, -include-pch is disabled.
    // Since -emit-pch is CC1option, it will not be added to command argments if
    // -ignore-pch is used.
    Args.eraseArg(options::OPT_include_pch);
  }
```

Though can you explain why you want to include `phases::Preprocess` here? seems 
like an unrelated change.

https://github.com/llvm/llvm-project/pull/142409
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to