[clang] [clang-repl] Suppress [[nodiscard]] warnings for REPL printed express (PR #178661)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 02:37:34 PST 2026
bala-bhargav wrote:
@vgvassilev
I've updated the PR to address all your comments — the fix is now entirely confined to
Interpreter.cpp with no changes to ParseDecl.cpp or any other file. The approach is i suppresses warn_unused_result before parsing (since we don't know the semicolon status at that point), and after parsing, re-enables the warning and explicitly diagnoses [[nodiscard]] only for
TopLevelStmtDecl
expressions where the semicolon is present (i.e., the value is genuinely being discarded). A test has been added covering both scenarios. I would appreciate your review, and please do let me know if you'd prefer a different approach — I'm happy to follow in your guidance.
https://github.com/llvm/llvm-project/pull/178661
More information about the cfe-commits
mailing list