LLVM: lib/Analysis/ModuleDebugInfoPrinter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
24using namespace llvm;
25
27 unsigned Line = 0) {
28 if (Filename.empty())
29 return;
30
31 O << " from ";
32 if (!Directory.empty())
33 O << Directory << "/";
34 O << Filename;
35 if (Line)
36 O << ":" << Line;
37}
38
41
42
43
45 O << "Compile unit: ";
46
48 auto LangStr =
53
54 if (!LangStr.empty())
55 O << LangStr;
56 else
57 O << "unknown-language(" << CU->getSourceLanguage().getName() << ")";
58
59 printFile(O, CU->getFilename(), CU->getDirectory());
60 O << '\n';
61 }
62
64 O << "Subprogram: " << S->getName();
65 printFile(O, S->getFilename(), S->getDirectory(), S->getLine());
66 if (!S->getLinkageName().empty())
67 O << " ('" << S->getLinkageName() << "')";
68 O << '\n';
69 }
70
72 const auto *GV = GVU->getVariable();
73 O << "Global variable: " << GV->getName();
74 printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
75 if (!GV->getLinkageName().empty())
76 O << " ('" << GV->getLinkageName() << "')";
77 O << '\n';
78 }
79
81 O << "Type:";
82 if (->getName().empty())
83 O << ' ' << T->getName();
84 printFile(O, T->getFilename(), T->getDirectory(), T->getLine());
86 O << " ";
88 if (!Encoding.empty())
89 O << Encoding;
90 else
91 O << "unknown-encoding(" << BT->getEncoding() << ')';
92 } else {
93 O << ' ';
95 if (!Tag.empty())
96 O << Tag;
97 else
98 O << "unknown-tag(" << T->getTag() << ")";
99 }
101 if (auto *S = CT->getRawIdentifier())
102 O << " (identifier: '" << S->getString() << "')";
103 }
104 O << '\n';
105 }
106}
107
110
113 Finder.processModule(M);
116}
This file contains constants used for implementing Dwarf debug support.
This header defines various interfaces for pass management in LLVM.
static void printModuleDebugInfo(raw_ostream &O, const Module *M, const DebugInfoFinder &Finder)
Definition ModuleDebugInfoPrinter.cpp:39
static void printFile(raw_ostream &O, StringRef Filename, StringRef Directory, unsigned Line=0)
Definition ModuleDebugInfoPrinter.cpp:26
Wrapper structure that holds a language name and its version.
bool hasVersionedName() const
uint16_t getName() const
Returns a versioned or unversioned language name.
Subprogram description. Uses SubclassData1.
Utility to find all debug info in a module.
iterator_range< global_variable_expression_iterator > global_variables() const
iterator_range< subprogram_iterator > subprograms() const
iterator_range< type_iterator > types() const
iterator_range< compile_unit_iterator > compile_units() const
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition ModuleDebugInfoPrinter.cpp:111
ModuleDebugInfoPrinterPass(raw_ostream &OS)
Definition ModuleDebugInfoPrinter.cpp:108
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
This class implements an extremely fast bulk output stream that can only output to a stream.
LLVM_ABI StringRef SourceLanguageNameString(SourceLanguageName Lang)
LLVM_ABI StringRef LanguageString(unsigned Language)
LLVM_ABI StringRef AttributeEncodingString(unsigned Encoding)
LLVM_ABI StringRef TagString(unsigned Tag)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.