[clang] [Preprocessor] Do not expand macros if the input is already preprocessed (PR #137665)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 00:04:59 PDT 2025


Juan Manuel Martinez =?utf-8?q?Caama=C3=B1o?= <juamarti at amd.com>,
Juan Manuel Martinez =?utf-8?q?Caama=C3=B1o?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/137665 at github.com>


================
@@ -98,7 +100,11 @@ class FrontendAction {
   ///
   /// This is guaranteed to only be called following a successful call to
   /// BeginSourceFileAction (and BeginSourceFile).
-  virtual void EndSourceFileAction() {}
+  virtual void EndSourceFileAction() {
+    if (CurrentInput.isPreprocessed())
+      // reset the preprocessor macro expansion to the default
----------------
cor3ntin wrote:

```suggestion
      // reset the preprocessor macro expansion to the default.
```

https://github.com/llvm/llvm-project/pull/137665


More information about the cfe-commits mailing list