Skip to content

Commit 3808087

Browse files
CopilotCopilot
andcommitted
Add CharacterLiteral support in trRValue
Character literals ('A', '\n', etc.) were falling through the rvalue visitor's dyn_cast chain and producing 'unsupported rvalue expression CharacterLiteral' diagnostics, which became (admit()) in the emitted Pulse code. Translate them as IntLit nodes of the appropriate (int) type, matching how the C standard defines character constants. Verified on MSQuic's src/core: eliminates all 286 CharacterLiteral diagnostics and reduces the total admit count from 19,910 to 19,826 (-84). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d0bd663 commit 3808087

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cpp/impl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,11 @@ class PALConsumer : public ASTConsumer {
618618
return mk_int_lit(std::move(loc), toBigInt(il->getValue()),
619619
std::move(ty));
620620
}
621+
} else if (auto cl = dyn_cast<CharacterLiteral>(e)) {
622+
auto ty = trQualType(cl->getType(), cl->getSourceRange());
623+
return mk_int_lit(std::move(loc),
624+
mk_bigint(toStr(std::to_string(cl->getValue()))),
625+
std::move(ty));
621626
} else if (auto uo = dyn_cast<UnaryOperator>(e)) {
622627
switch (uo->getOpcode()) {
623628
case UO_AddrOf:

0 commit comments

Comments
 (0)