Skip to content

Commit 8ff7d03

Browse files
committed
Add some comments
1 parent c07dc09 commit 8ff7d03

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,12 @@ enum class StringLiteralKind {
17571757
UTF16,
17581758
UTF32,
17591759
Unevaluated,
1760+
// Binary kind of string literal is used for the data coming via #embed
1761+
// directive. File's binary contents is transformed to a special kind of
1762+
// string literal that in some cases may be used directly as an initializer
1763+
// and some features of classic string literals are not applicable to this
1764+
// kind of a string literal, for example finding a particular byte's source
1765+
// location for better diagnosing.
17601766
Binary
17611767
};
17621768

@@ -1889,6 +1895,8 @@ class StringLiteral final
18891895
int64_t getCodeUnitS(size_t I, uint64_t BitWidth) const {
18901896
int64_t V = getCodeUnit(I);
18911897
if (isOrdinary() || isWide()) {
1898+
// Ordinary and wide string literals have types that can be signed.
1899+
// It is important for checking C23 constexpr initializers.
18921900
unsigned Width = getCharByteWidth() * BitWidth;
18931901
llvm::APInt AInt(Width, (uint64_t)V);
18941902
V = AInt.getSExtValue();

0 commit comments

Comments
 (0)