1- From c18338dd444d7252e22735d3ee6c50c2320a7f17 Mon Sep 17 00:00:00 2001
1+ From e662db370ffe95bc663d1e1fa350ab3c35bd61b3 Mon Sep 17 00:00:00 2001
22From: Peter Goodman <
[email protected] >
33Date: Mon, 14 Nov 2022 14:51:27 -0500
44Subject: [PATCH] Patches for PASTA
@@ -7,6 +7,7 @@ Subject: [PATCH] Patches for PASTA
77 clang/include/clang/Lex/PPCallbacks.h | 120 +++++++++++
88 clang/include/clang/Lex/Preprocessor.h | 46 ++---
99 clang/include/clang/Lex/TokenLexer.h | 7 +-
10+ clang/lib/Lex/Lexer.cpp | 8 +
1011 clang/lib/Lex/PPDirectives.cpp | 147 ++++++++++----
1112 clang/lib/Lex/PPExpressions.cpp | 28 +++
1213 clang/lib/Lex/PPLexerChange.cpp | 38 ++++
@@ -15,7 +16,7 @@ Subject: [PATCH] Patches for PASTA
1516 clang/lib/Lex/Preprocessor.cpp | 43 +++-
1617 clang/lib/Lex/TokenLexer.cpp | 39 +++-
1718 clang/lib/Parse/ParseTemplate.cpp | 7 +
18- 11 files changed, 722 insertions(+), 79 deletions(-)
19+ 12 files changed, 730 insertions(+), 79 deletions(-)
1920
2021diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h
2122index 045df8711..cba195cff 100644
@@ -300,6 +301,25 @@ index 4d229ae61..923107b84 100644
300301
301302 public:
302303 /// Create a TokenLexer for the specified macro with the specified actual
304+ diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
305+ index a4cff403e..33f17b148 100644
306+ --- a/clang/lib/Lex/Lexer.cpp
307+ +++ b/clang/lib/Lex/Lexer.cpp
308+ @@ -2921,6 +2921,14 @@ void Lexer::ReadToEndOfLine(SmallVectorImpl<char> *Result) {
309+ }
310+ assert(Tmp.is(tok::eod) && "Unexpected token!");
311+
312+ + // PASTA PATCH: Visibility into all tokens.
313+ + if (PP) {
314+ + if (auto Callbacks = PP->getPPCallbacks()) {
315+ + Callbacks->Event(Tmp, PPCallbacks::TokenFromTokenLexer, 0u);
316+ + Callbacks->Event(Tmp, PPCallbacks::EndDirective, 0);
317+ + }
318+ + }
319+ +
320+ // Finally, we're done;
321+ return;
322+ }
303323diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
304324index 9a8fd4391..b20144c12 100644
305325--- a/clang/lib/Lex/PPDirectives.cpp
@@ -1618,5 +1638,5 @@ index e32ea6003..942c71526 100644
16181638 if (CachingTokens) {
16191639 // If the previous cached token is being merged, delete it.
16201640- -
1621- 2.38.1
1641+ 2.39.0
16221642
0 commit comments