[clang] 0e5813b - [clang][NFC] silences warnings

Christopher Di Bella via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 26 14:10:16 PDT 2022


Author: Abraham Corea Diaz
Date: 2022-08-26T21:09:39Z
New Revision: 0e5813b88e50576940070003e093d696390a6959

URL: https://github.com/llvm/llvm-project/commit/0e5813b88e50576940070003e093d696390a6959
DIFF: https://github.com/llvm/llvm-project/commit/0e5813b88e50576940070003e093d696390a6959.diff

LOG: [clang][NFC] silences warnings

* removes unused data member `OS` from `SARIFDiagnostic`
* flags `Filename` variable as currently unused

This is a follow-up to D131632.

Added: 
    

Modified: 
    clang/include/clang/Frontend/SARIFDiagnostic.h
    clang/lib/Frontend/SARIFDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Frontend/SARIFDiagnostic.h b/clang/include/clang/Frontend/SARIFDiagnostic.h
index bd0f1df9aa58..ec1d0b8e6a7c 100644
--- a/clang/include/clang/Frontend/SARIFDiagnostic.h
+++ b/clang/include/clang/Frontend/SARIFDiagnostic.h
@@ -55,8 +55,6 @@ class SARIFDiagnostic : public DiagnosticRenderer {
                                   StringRef ModuleName) override;
 
 private:
-  raw_ostream &OS;
-
   // Shared between SARIFDiagnosticPrinter and this renderer.
   SarifDocumentWriter *Writer;
 

diff  --git a/clang/lib/Frontend/SARIFDiagnostic.cpp b/clang/lib/Frontend/SARIFDiagnostic.cpp
index 2bcbd5cf34f2..f0f32a179825 100644
--- a/clang/lib/Frontend/SARIFDiagnostic.cpp
+++ b/clang/lib/Frontend/SARIFDiagnostic.cpp
@@ -33,7 +33,7 @@ namespace clang {
 SARIFDiagnostic::SARIFDiagnostic(raw_ostream &OS, const LangOptions &LangOpts,
                                  DiagnosticOptions *DiagOpts,
                                  SarifDocumentWriter *Writer)
-    : DiagnosticRenderer(LangOpts, DiagOpts), OS(OS), Writer(Writer) {}
+    : DiagnosticRenderer(LangOpts, DiagOpts), Writer(Writer) {}
 
 // FIXME(llvm-project/issues/57323): Refactor Diagnostic classes.
 void SARIFDiagnostic::emitDiagnosticMessage(
@@ -71,7 +71,8 @@ SarifResult SARIFDiagnostic::addLocationToResult(
     FileID FID = Loc.getFileID();
     if (FID.isValid()) {
       if (const FileEntry *FE = Loc.getFileEntry()) {
-        emitFilename(FE->getName(), Loc.getManager());
+        [[gnu::unused]] llvm::StringRef Filename =
+            emitFilename(FE->getName(), Loc.getManager());
         // FIXME(llvm-project/issues/57366): File-only locations
       }
     }


        


More information about the cfe-commits mailing list