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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 05:08:02 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>,
Juan Manuel Martinez =?utf-8?q?Caama=C3=B1o?=
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.
----------------
AaronBallman 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