Author: Timm Bäder
Date: 2023-07-26T10:06:26+02:00
New Revision: 47446939e0e60cf52ffdd3fa671949ff3183a4ca

URL: 
https://github.com/llvm/llvm-project/commit/47446939e0e60cf52ffdd3fa671949ff3183a4ca
DIFF: 
https://github.com/llvm/llvm-project/commit/47446939e0e60cf52ffdd3fa671949ff3183a4ca.diff

LOG: [clang][Interp][NFC] Move CastKind operator<< to PrimTypes.h

So it actually works when using dump().

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp
index ef4c81326d2db8..35ed5d12869719 100644
--- a/clang/lib/AST/Interp/Disasm.cpp
+++ b/clang/lib/AST/Interp/Disasm.cpp
@@ -73,12 +73,3 @@ LLVM_DUMP_METHOD void Program::dump(llvm::raw_ostream &OS) 
const {
     Anon->dump();
   }
 }
-
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, interp::CastKind CK) {
-  switch (CK) {
-  case interp::CastKind::Reinterpret:
-    OS << "reinterpret_cast";
-    break;
-  }
-  return OS;
-}

diff  --git a/clang/lib/AST/Interp/PrimType.h b/clang/lib/AST/Interp/PrimType.h
index c7078c6f19c1a2..ba4f630b126437 100644
--- a/clang/lib/AST/Interp/PrimType.h
+++ b/clang/lib/AST/Interp/PrimType.h
@@ -46,7 +46,15 @@ enum PrimType : unsigned {
 enum class CastKind : uint8_t {
   Reinterpret,
 };
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, interp::CastKind CK);
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     interp::CastKind CK) {
+  switch (CK) {
+  case interp::CastKind::Reinterpret:
+    OS << "reinterpret_cast";
+    break;
+  }
+  return OS;
+}
 
 constexpr bool isIntegralType(PrimType T) { return T <= PT_Uint64; }
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to