[clang] [clang] Inject tokens containing #embed back into token stream (PR #97274)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 1 03:10:08 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 8bb00cb160830ec8f6029c2aae79d3e46b04b99c 4d5008fcf3ac37fa213c8f2cf42c3cce6369c83d -- clang/include/clang/Basic/TokenKinds.h clang/include/clang/Lex/Preprocessor.h clang/include/clang/Parse/Parser.h clang/lib/Parse/ParseExpr.cpp clang/lib/Parse/ParseTemplate.cpp clang/lib/Sema/SemaExpr.cpp clang/test/Preprocessor/embed_codegen.cpp clang/test/Preprocessor/embed_constexpr.cpp clang/test/Preprocessor/embed_weird.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 8e30756da2..591c1fccf9 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -2124,8 +2124,7 @@ public:
getSpellingOfSingleCharacterNumericConstant(const Token &Tok,
bool *Invalid = nullptr) const {
assert((Tok.is(tok::numeric_constant) || Tok.is(tok::binary_data)) &&
- Tok.getLength() == 1 &&
- "Called on unsupported token");
+ Tok.getLength() == 1 && "Called on unsupported token");
assert(!Tok.needsCleaning() && "Token can't need cleaning with length 1");
// If the token is carrying a literal data pointer, just use it.
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index a3b800a35b..88169037f0 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -3573,9 +3573,9 @@ ExprResult Parser::ParseFoldExpression(ExprResult LHS,
void Parser::injectEmbedTokens() {
EmbedAnnotationData *Data =
reinterpret_cast<EmbedAnnotationData *>(Tok.getAnnotationValue());
- MutableArrayRef<Token> Toks(
- PP.getPreprocessorAllocator().Allocate<Token>(Data->BinaryData.size() * 2 - 1),
- Data->BinaryData.size() * 2 - 1);
+ MutableArrayRef<Token> Toks(PP.getPreprocessorAllocator().Allocate<Token>(
+ Data->BinaryData.size() * 2 - 1),
+ Data->BinaryData.size() * 2 - 1);
unsigned I = 0;
for (auto &Byte : Data->BinaryData) {
Toks[I].startToken();
``````````
</details>
https://github.com/llvm/llvm-project/pull/97274
More information about the cfe-commits
mailing list