[clang] [Clang] [C++26] Iterating expansion statements using string injection (PR #208877)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 02:12:27 PDT 2026


================
@@ -185,12 +185,11 @@ class Lexer : public PreprocessorLexer {
   Lexer(const Lexer &) = delete;
   Lexer &operator=(const Lexer &) = delete;
 
-  /// Create_PragmaLexer: Lexer constructor - Create a new lexer object for
-  /// _Pragma expansion.  This has a variety of magic semantics that this method
-  /// sets up.
-  static std::unique_ptr<Lexer> Create_PragmaLexer(
-      SourceLocation SpellingLoc, SourceLocation ExpansionLocStart,
-      SourceLocation ExpansionLocEnd, unsigned TokLen, Preprocessor &PP);
+  /// CreateScratchLexer: Lexer constructor - Create a new lexer object that
+  /// places 'Code' in the scratch buffer and lexes from it.
+  static std::unique_ptr<Lexer>
+  CreateScratchLexer(StringRef Code, SourceLocation ExpansionLocStart,
+                     SourceLocation ExpansionLocEnd, Preprocessor &PP);
----------------
cor3ntin wrote:

Why `ExpansionLocEnd` / `ExpansionLocStart` ?
Why is it static if we have to pass the preprocessor anyway?

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


More information about the cfe-commits mailing list