aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2019-11-02 17:18:37 +0000
committerSergio Martins <smartins@kde.org>2019-11-02 17:19:04 +0000
commitbd024710d5189254094b3fa14f9b43b61dc9ce0f (patch)
treefeb6658f3e54c905630032cb6bdad6ac7344e433
parent6b140de078c0dc6f5e6d6732512ad5e454d887d0 (diff)
Dont' generate an empty yaml file if there's no fixits
CCMAIL: kfunk@kde.org
-rw-r--r--src/FixItExporter.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/FixItExporter.cpp b/src/FixItExporter.cpp
index 7073b8c2..f3af2e54 100644
--- a/src/FixItExporter.cpp
+++ b/src/FixItExporter.cpp
@@ -189,10 +189,13 @@ void FixItExporter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const D
void FixItExporter::Export()
{
- std::error_code EC;
- llvm::raw_fd_ostream OS(exportFixes, EC, llvm::sys::fs::F_None);
- llvm::yaml::Output YAML(OS);
- YAML << getTuDiag();
+ auto tuDiag = getTuDiag();
+ if (!tuDiag.Diagnostics.empty()) {
+ std::error_code EC;
+ llvm::raw_fd_ostream OS(exportFixes, EC, llvm::sys::fs::F_None);
+ llvm::yaml::Output YAML(OS);
+ YAML << getTuDiag();
+ }
}
void FixItExporter::Diag(SourceLocation Loc, unsigned DiagID)