[clang] [clang][bytecode] Check `diagnosing()` in `Invalid()` (PR #227640)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 30 03:14:09 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
In large C TUs, it happens pretty frequently that we reject something via `Invalid()`, but nobody ever gets to see the diagnostics we emit. Just don't emit a diagnostic in that case.
---
Full diff: https://github.com/llvm/llvm-project/pull/227640.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/InterpHelpers.h (+4-3)
``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpHelpers.h b/clang/lib/AST/ByteCode/InterpHelpers.h
index 50f0462a93f162..25881bbfe1a3bd 100644
--- a/clang/lib/AST/ByteCode/InterpHelpers.h
+++ b/clang/lib/AST/ByteCode/InterpHelpers.h
@@ -126,9 +126,10 @@ static inline llvm::RoundingMode getRoundingMode(FPOptions FPO) {
}
inline bool Invalid(InterpState &S, CodePtr OpPC) {
- const SourceLocation &Loc = S.Current->getLocation(OpPC);
- S.FFDiag(Loc, diag::note_invalid_subexpr_in_const_expr)
- << S.Current->getRange(OpPC);
+ if (S.diagnosing())
+ S.FFDiag(S.Current->getSource(OpPC),
+ diag::note_invalid_subexpr_in_const_expr)
+ << S.Current->getRange(OpPC);
return false;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/227640
More information about the cfe-commits
mailing list