[clang] [clang][Lex][NFC] Simplify macro expansion state restoration (PR #239918)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 01:50:57 PST 2026


================
@@ -898,7 +899,8 @@ Preprocessor::EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro,
   // to recursively expand in order to get more gcc-list behavior, so we force
   // DisableMacroExpansion to false and restore it when we're done parsing the
   // expression.
-  bool DisableMacroExpansionAtStartOfDirective = DisableMacroExpansion;
+  llvm::scope_exit RestoreMacroExpansion(
----------------
ChenMiaoi wrote:

`DisableMacroExpansion` is a bit-field and cannot be bound to a T& (`llvm::SaveAndRestore`)?

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


More information about the cfe-commits mailing list