Skip to content

Commit 5288d56

Browse files
author
Peter Goodman
authored
LLVM 15[pasta]: Patch for observing the end of macro directives for some pragmas, error, and warning directives. (#1002)
1 parent de572a0 commit 5288d56

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

ports/llvm-15/0025-PASTA-patches.patch

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From c18338dd444d7252e22735d3ee6c50c2320a7f17 Mon Sep 17 00:00:00 2001
1+
From e662db370ffe95bc663d1e1fa350ab3c35bd61b3 Mon Sep 17 00:00:00 2001
22
From: Peter Goodman <[email protected]>
33
Date: Mon, 14 Nov 2022 14:51:27 -0500
44
Subject: [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

2021
diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h
2122
index 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+
}
303323
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
304324
index 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

ports/llvm-15/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "llvm-15",
33
"version": "15.0.6",
4-
"port-version": 3,
4+
"port-version": 4,
55
"description": "The LLVM Compiler Infrastructure.",
66
"homepage": "https://llvm.org",
77
"license": "Apache-2.0",

0 commit comments

Comments
 (0)