[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 12:04:42 PDT 2024


================
@@ -1180,6 +1180,14 @@ void Sema::PrintPragmaAttributeInstantiationPoint() {
                diag::note_pragma_attribute_applied_decl_here);
 }
 
+void Sema::DiagnoseExcessPrecision() {
+  if (NumExcessPrecisionNotSatisfied > 0) {
+    for (auto &[Loc, Type, Num] : ExcessPrecisionNotSatisfied)
+      Diag(Loc, diag::warn_excess_precision_not_supported)
+          << 0 << Type << static_cast<bool>(Num);
+  }
----------------
AaronBallman wrote:

```suggestion
  for (auto &[Loc, Type, Num] : ExcessPrecisionNotSatisfied) {
    assert(LocationOfExcessPrecisionNotSatisfied.isValid() && "expected a valid source location");
    Diag(LocationOfExcessPrecisionNotSatisfied, diag::warn_excess_precision_not_supported)
        << 0 << Type << static_cast<bool>(Num);
  }
```

https://github.com/llvm/llvm-project/pull/107397


More information about the cfe-commits mailing list