| 1 | //===- Diagnostic.cpp -----------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "mlir/Tools/PDLL/AST/Diagnostic.h" |
| 10 | |
| 11 | using namespace mlir; |
| 12 | using namespace mlir::pdll::ast; |
| 13 | |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | // InFlightDiagnostic |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | |
| 18 | void InFlightDiagnostic::report() { |
| 19 | // If this diagnostic is still inflight and it hasn't been abandoned, then |
| 20 | // report it. |
| 21 | if (isInFlight()) { |
| 22 | owner->report(diagnostic: std::move(*impl)); |
| 23 | owner = nullptr; |
| 24 | } |
| 25 | impl.reset(); |
| 26 | } |
| 27 | |