Index: include/llvm/Support/Debug.h =================================================================== --- include/llvm/Support/Debug.h +++ include/llvm/Support/Debug.h @@ -51,6 +51,12 @@ /// void setCurrentDebugType(const char *Type); +/// setCurrentDebugTypes - Set the current debug type, as if the +/// -debug-only=X,Y,Z option were specified. Note that DebugFlag +/// also needs to be set to true for debug output to be produced. +/// +void setCurrentDebugTypes(const char **Types, unsigned Count); + /// DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug /// information. In the '-debug' option is specified on the commandline, and if /// this is a debug build, then the code specified as the option to the macro @@ -67,6 +73,7 @@ #else #define isCurrentDebugType(X) (false) #define setCurrentDebugType(X) +#define setCurrentDebugTypes(X, N) #define DEBUG_WITH_TYPE(TYPE, X) do { } while (false) #endif Index: lib/Support/Debug.cpp =================================================================== --- lib/Support/Debug.cpp +++ lib/Support/Debug.cpp @@ -63,10 +63,14 @@ /// debug output to be produced. /// void setCurrentDebugType(const char *Type) { - CurrentDebugType->clear(); - CurrentDebugType->push_back(Type); + setCurrentDebugTypes(&Type, 1); } +void setCurrentDebugTypes(const char **Types, size_t Count) { + CurrentDebugType->clear(); + for (size_t T = 0; T < Count; ++T) + CurrentDebugType->push_back(Types[T]); +} } // namespace llvm // All Debug.h functionality is a no-op in NDEBUG mode.