28 class ModuleDebugInfoPrinter :
public ModulePass {
36 bool runOnModule(
Module &M)
override;
47 "Decodes module-level debug info",
false,
true)
50 return new ModuleDebugInfoPrinter();
53 bool ModuleDebugInfoPrinter::runOnModule(
Module &M) {
54 Finder.processModule(M);
64 if (!Directory.
empty())
65 O << Directory <<
"/";
76 O <<
"Compile unit: ";
80 O <<
"unknown-language(" << CU->getSourceLanguage() <<
")";
81 printFile(O, CU->getFilename(), CU->getDirectory());
86 O <<
"Subprogram: " << S->getName();
87 printFile(O, S->getFilename(), S->getDirectory(), S->getLine());
88 if (!S->getLinkageName().empty())
89 O <<
" ('" << S->getLinkageName() <<
"')";
94 O <<
"Global variable: " << GV->getName();
95 printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
96 if (!GV->getLinkageName().empty())
97 O <<
" ('" << GV->getLinkageName() <<
"')";
101 for (
const DIType *
T : Finder.types()) {
103 if (!
T->getName().empty())
104 O <<
' ' <<
T->getName();
105 printFile(O,
T->getFilename(),
T->getDirectory(),
T->getLine());
106 if (
auto *
BT = dyn_cast<DIBasicType>(
T)) {
108 if (
const char *Encoding =
112 O <<
"unknown-encoding(" <<
BT->getEncoding() <<
')';
118 O <<
"unknown-tag(" <<
T->getTag() <<
")";
120 if (
auto *CT = dyn_cast<DICompositeType>(
T)) {
121 if (
auto *S = CT->getRawIdentifier())
122 O <<
" (identifier: '" << S->getString() <<
"')";
const char * LanguageString(unsigned Language)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A Module instance is used to store all the information related to an LLVM module. ...
INITIALIZE_PASS(ModuleDebugInfoPrinter,"module-debuginfo","Decodes module-level debug info", false, true) ModulePass *llvm
const char * TagString(unsigned Tag)
Utility to find all debug info in a module.
static void printFile(raw_ostream &O, StringRef Filename, StringRef Directory, unsigned Line=0)
void print(raw_ostream &O) const
Implement operator<< on Value.
void initializeModuleDebugInfoPrinterPass(PassRegistry &)
Represent the analysis usage information of a pass.
const char * AttributeEncodingString(unsigned Encoding)
void setPreservesAll()
Set by analyses that do not transform their input at all.
ModulePass * createModuleDebugInfoPrinterPass()
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
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.
bool empty() const
empty - Check if the string is empty.