From db8a6d5b3e47ecd72e45b14baab26c6dbe1b15f0 Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 25 May 2020 10:57:21 +0200 Subject: [PATCH] Added path to FixIT struct --- src/diagnostic.cc | 3 ++- src/diagnostic.h | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/diagnostic.cc b/src/diagnostic.cc index b4efc1d..715a721 100644 --- a/src/diagnostic.cc +++ b/src/diagnostic.cc @@ -19,6 +19,7 @@ clangmm::Diagnostic::Diagnostic(CXTranslationUnit &cx_tu, CXDiagnostic &cx_diagn for(unsigned c = 0; c < num_fix_its; c++) { CXSourceRange fix_it_range; auto source = to_string(clang_getDiagnosticFixIt(cx_diagnostic, c, &fix_it_range)); - fix_its.emplace_back(source, SourceRange(fix_it_range).get_offsets()); + auto range = SourceRange(fix_it_range); + fix_its.emplace_back(FixIt{std::move(source), range.get_start().get_path(), range.get_offsets()}); } } diff --git a/src/diagnostic.h b/src/diagnostic.h index f13f488..bee6aca 100644 --- a/src/diagnostic.h +++ b/src/diagnostic.h @@ -19,11 +19,9 @@ namespace clangmm { Fatal }; - class FixIt { - public: - FixIt(const std::string &source, const std::pair &offsets) - : source(source), offsets(offsets) {} + struct FixIt { std::string source; + std::string path; std::pair offsets; };