Skip to content

Commit 8f031c1

Browse files
authored
Update PPMacroExpansion.cpp
1 parent 7ee22f3 commit 8f031c1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,15 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
15551555
// __LINE__ expands to a simple numeric value.
15561556
OS << (PLoc.isValid()? PLoc.getLine() : 1);
15571557
Tok.setKind(tok::numeric_constant);
1558+
} else if (II == Ident__RANDOM__NUMERIC__) {
1559+
// __RANDOM__NUMERIC__: A random number (an integer constant).
1560+
// This is a llvm-msvc specific extension.
1561+
std::random_device RD;
1562+
std::uniform_int_distribution<uint64_t> Dist(
1563+
std::numeric_limits<uint64_t>::min(),
1564+
std::numeric_limits<uint64_t>::max());
1565+
OS << Dist(RD);
1566+
Tok.setKind(tok::numeric_constant);
15581567
} else if (II == Ident__FILE__ || II == Ident__BASE_FILE__ ||
15591568
II == Ident__FILE_NAME__ || II == Ident__FUNCTION__) {
15601569
// C99 6.10.8: "__FILE__: The presumed name of the current source file (a

0 commit comments

Comments
 (0)