Author: Aaron Ballman Date: 2024-08-06T08:55:30-04:00 New Revision: 295e4f49aefb2b07501be9f845df598b3ee280f1
URL: https://github.com/llvm/llvm-project/commit/295e4f49aefb2b07501be9f845df598b3ee280f1 DIFF: https://github.com/llvm/llvm-project/commit/295e4f49aefb2b07501be9f845df598b3ee280f1.diff LOG: Correct a comment and update a return type; NFC These changes were inspired by a post-commit review comment: https://github.com/llvm/llvm-project/pull/97274#pullrequestreview-2220175564 Added: Modified: clang/include/clang/Lex/Preprocessor.h clang/lib/Sema/SemaExpr.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 623f868ca1e64..1307659e27d13 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -2139,8 +2139,8 @@ class Preprocessor { } /// Given a Token \p Tok that is a numeric constant with length 1, - /// return the character. - char + /// return the value of constant as an unsigned 8-bit integer. + uint8_t getSpellingOfSingleCharacterNumericConstant(const Token &Tok, bool *Invalid = nullptr) const { assert((Tok.is(tok::numeric_constant) || Tok.is(tok::binary_data)) && diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index b1b0d1cbbd31d..72cd92a7537f9 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3652,7 +3652,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // Fast path for a single digit (which is quite common). A single digit // cannot have a trigraph, escaped newline, radix prefix, or suffix. if (Tok.getLength() == 1 || Tok.getKind() == tok::binary_data) { - const char Val = PP.getSpellingOfSingleCharacterNumericConstant(Tok); + const uint8_t Val = PP.getSpellingOfSingleCharacterNumericConstant(Tok); return ActOnIntegerConstant(Tok.getLocation(), Val); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits