[PATCH] D142694: [clang][Interp] Only generate disassembly in debug builds

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 3 06:40:58 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60dcc70e48fa: [clang][Interp] Only generate disassembly in debug builds (authored by tbaeder).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142694/new/

https://reviews.llvm.org/D142694

Files:
  clang/lib/AST/Interp/Disasm.cpp
  clang/utils/TableGen/ClangOpcodesEmitter.cpp


Index: clang/utils/TableGen/ClangOpcodesEmitter.cpp
===================================================================
--- clang/utils/TableGen/ClangOpcodesEmitter.cpp
+++ clang/utils/TableGen/ClangOpcodesEmitter.cpp
@@ -161,6 +161,7 @@
 }
 
 void ClangOpcodesEmitter::EmitDisasm(raw_ostream &OS, StringRef N, Record *R) {
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   OS << "#ifdef GET_DISASM\n";
   Enumerate(R, N, [R, &OS](ArrayRef<Record *>, const Twine &ID) {
     OS << "case OP_" << ID << ":\n";
@@ -176,6 +177,7 @@
     OS << "  continue;\n";
   });
   OS << "#endif\n";
+#endif
 }
 
 void ClangOpcodesEmitter::EmitEmitter(raw_ostream &OS, StringRef N, Record *R) {
Index: clang/lib/AST/Interp/Disasm.cpp
===================================================================
--- clang/lib/AST/Interp/Disasm.cpp
+++ clang/lib/AST/Interp/Disasm.cpp
@@ -34,6 +34,7 @@
 LLVM_DUMP_METHOD void Function::dump() const { dump(llvm::errs()); }
 
 LLVM_DUMP_METHOD void Function::dump(llvm::raw_ostream &OS) const {
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   if (F) {
     if (const auto *MD = dyn_cast<CXXMethodDecl>(F))
       OS << MD->getParent()->getDeclName() << "::";
@@ -64,6 +65,7 @@
 #undef GET_DISASM
     }
   }
+#endif
 }
 
 LLVM_DUMP_METHOD void Program::dump() const { dump(llvm::errs()); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142694.494614.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230203/a4532c87/attachment.bin>


More information about the cfe-commits mailing list