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

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 01:41:38 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(
----------------
zwuis wrote:

Use `llvm::SaveAndRestore`.

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


More information about the cfe-commits mailing list