[clang] 83b97b3 - [clang] Fix a -Wcast-qual GCC warning. NFC.

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 28 06:11:54 PDT 2022


Author: Martin Storsjö
Date: 2022-10-28T16:11:34+03:00
New Revision: 83b97b3b277281c3b90d245c7816addccc756158

URL: https://github.com/llvm/llvm-project/commit/83b97b3b277281c3b90d245c7816addccc756158
DIFF: https://github.com/llvm/llvm-project/commit/83b97b3b277281c3b90d245c7816addccc756158.diff

LOG: [clang] Fix a -Wcast-qual GCC warning. NFC.

This fixes the following warning:

../tools/clang/lib/AST/Interp/Disasm.cpp: In member function ‘void clang::interp::Function::dump(llvm::raw_ostream&) const’:
../tools/clang/lib/AST/Interp/Disasm.cpp:43:25: warning: cast from type ‘const clang::interp::Function*’ to type ‘void*’ casts away qualifiers [-Wcast-qual]
   43 |     OS << " " << (void*)this << ":\n";
      |                         ^~~~

Added: 
    

Modified: 
    clang/lib/AST/Interp/Disasm.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp
index db68887f0558..82debe4fcae1 100644
--- a/clang/lib/AST/Interp/Disasm.cpp
+++ b/clang/lib/AST/Interp/Disasm.cpp
@@ -40,7 +40,7 @@ LLVM_DUMP_METHOD void Function::dump(llvm::raw_ostream &OS) const {
     } else {
       OS << F->getDeclName();
     }
-    OS << " " << (void*)this << ":\n";
+    OS << " " << (const void*)this << ":\n";
   } else {
     OS << "<<expr>>\n";
   }


        


More information about the cfe-commits mailing list