aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2024-08-06 08:54:14 -0400
committerAaron Ballman <aaron@aaronballman.com>2024-08-06 08:55:30 -0400
commit295e4f49aefb2b07501be9f845df598b3ee280f1 (patch)
tree45cbda166b62fce2f0e71dafccbe918b744cd0c6
parentdf0f31315ec1a14f24746d5fbcea99aa67a4846d (diff)
downloadllvm-295e4f49aefb2b07501be9f845df598b3ee280f1.zip
llvm-295e4f49aefb2b07501be9f845df598b3ee280f1.tar.gz
llvm-295e4f49aefb2b07501be9f845df598b3ee280f1.tar.bz2
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
-rw-r--r--clang/include/clang/Lex/Preprocessor.h4
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 623f868..1307659 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -2139,8 +2139,8 @@ public:
}
/// 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 b1b0d1c..72cd92a 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);
}