27 class ModuleDebugInfoPrinter :
public ModulePass {
35 bool runOnModule(
Module &M)
override;
46 "Decodes module-level debug info",
false,
true)
49 return new ModuleDebugInfoPrinter();
52 bool ModuleDebugInfoPrinter::runOnModule(
Module &M) {
63 if (!Directory.
empty())
64 O << Directory <<
"/";
75 O <<
"Compile unit: ";
80 O <<
"unknown-language(" <<
CU->getSourceLanguage() <<
")";
86 O <<
"Subprogram: " << S->getName();
87 printFile(O, S->getFilename(), S->getDirectory(), S->getLine());
88 if (!S->getLinkageName().empty())
89 O <<
" ('" << S->getLinkageName() <<
"')";
94 const auto *GV = GVU->getVariable();
95 O <<
"Global variable: " << GV->getName();
96 printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
97 if (!GV->getLinkageName().empty())
98 O <<
" ('" << GV->getLinkageName() <<
"')";
104 if (!
T->getName().empty())
105 O <<
' ' <<
T->getName();
106 printFile(O,
T->getFilename(),
T->getDirectory(),
T->getLine());
107 if (
auto *
BT = dyn_cast<DIBasicType>(
T)) {
110 if (!Encoding.empty())
113 O <<
"unknown-encoding(" <<
BT->getEncoding() <<
')';
120 O <<
"unknown-tag(" <<
T->getTag() <<
")";
122 if (
auto *CT = dyn_cast<DICompositeType>(
T)) {
123 if (
auto *S = CT->getRawIdentifier())
124 O <<
" (identifier: '" << S->getString() <<
"')";
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void processModule(const Module &M)
Process entire module and collect debug info anchors.
Utility to find all debug info in a module.
static void printFile(raw_ostream &O, StringRef Filename, StringRef Directory, unsigned Line=0)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
StringRef LanguageString(unsigned Language)
iterator_range< type_iterator > types() const
INITIALIZE_PASS(ModuleDebugInfoPrinter, "module-debuginfo", "Decodes module-level debug info", false, true) ModulePass *llvm
void initializeModuleDebugInfoPrinterPass(PassRegistry &)
StringRef AttributeEncodingString(unsigned Encoding)
Represent the analysis usage information of a pass.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
iterator_range< compile_unit_iterator > compile_units() const
iterator_range< global_variable_expression_iterator > global_variables() const
void setPreservesAll()
Set by analyses that do not transform their input at all.
ModulePass * createModuleDebugInfoPrinterPass()
StringRef TagString(unsigned Tag)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
iterator_range< subprogram_iterator > subprograms() const
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.