aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ModuleDebugInfoPrinter.cpp
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-04-10 22:08:18 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-10 22:08:18 +0000
commit13a7db5b9c4f5e543d037be68ec3428216bfd550 (patch)
tree1b2c9792582e12f5af0b1512e3094425f0dc0df9 /lib/Analysis/ModuleDebugInfoPrinter.cpp
parent0eb46f5d1e06a4284663d636a74b06adc3a161d7 (diff)
parent31195f0bdca6ee2a5e72d07edf13e1d81206d949 (diff)
downloadexternal_llvm-13a7db5b9c4f5e543d037be68ec3428216bfd550.zip
external_llvm-13a7db5b9c4f5e543d037be68ec3428216bfd550.tar.gz
external_llvm-13a7db5b9c4f5e543d037be68ec3428216bfd550.tar.bz2
am 31195f0b: Merge "Update aosp/master llvm for rebase to r233350"
* commit '31195f0bdca6ee2a5e72d07edf13e1d81206d949': Update aosp/master llvm for rebase to r233350
Diffstat (limited to 'lib/Analysis/ModuleDebugInfoPrinter.cpp')
-rw-r--r--lib/Analysis/ModuleDebugInfoPrinter.cpp62
1 files changed, 54 insertions, 8 deletions
diff --git a/lib/Analysis/ModuleDebugInfoPrinter.cpp b/lib/Analysis/ModuleDebugInfoPrinter.cpp
index f645558..cbc4700 100644
--- a/lib/Analysis/ModuleDebugInfoPrinter.cpp
+++ b/lib/Analysis/ModuleDebugInfoPrinter.cpp
@@ -55,28 +55,74 @@ bool ModuleDebugInfoPrinter::runOnModule(Module &M) {
return false;
}
+static void printFile(raw_ostream &O, StringRef Filename, StringRef Directory,
+ unsigned Line = 0) {
+ if (Filename.empty())
+ return;
+
+ O << " from ";
+ if (!Directory.empty())
+ O << Directory << "/";
+ O << Filename;
+ if (Line)
+ O << ":" << Line;
+}
+
void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
+ // Printing the nodes directly isn't particularly helpful (since they
+ // reference other nodes that won't be printed, particularly for the
+ // filenames), so just print a few useful things.
for (DICompileUnit CU : Finder.compile_units()) {
- O << "Compile Unit: ";
- CU.print(O);
+ O << "Compile unit: ";
+ if (const char *Lang = LanguageString(CU.getLanguage()))
+ O << Lang;
+ else
+ O << "unknown-language(" << CU.getLanguage() << ")";
+ printFile(O, CU.getFilename(), CU.getDirectory());
O << '\n';
}
for (DISubprogram S : Finder.subprograms()) {
- O << "Subprogram: ";
- S.print(O);
+ O << "Subprogram: " << S.getName();
+ printFile(O, S.getFilename(), S.getDirectory(), S.getLineNumber());
+ if (!S.getLinkageName().empty())
+ O << " ('" << S.getLinkageName() << "')";
O << '\n';
}
for (DIGlobalVariable GV : Finder.global_variables()) {
- O << "GlobalVariable: ";
- GV.print(O);
+ O << "Global variable: " << GV.getName();
+ printFile(O, GV.getFilename(), GV.getDirectory(), GV.getLineNumber());
+ if (!GV.getLinkageName().empty())
+ O << " ('" << GV.getLinkageName() << "')";
O << '\n';
}
for (DIType T : Finder.types()) {
- O << "Type: ";
- T.print(O);
+ O << "Type:";
+ if (!T.getName().empty())
+ O << ' ' << T.getName();
+ printFile(O, T.getFilename(), T.getDirectory(), T.getLineNumber());
+ if (T.isBasicType()) {
+ DIBasicType BT(T.get());
+ O << " ";
+ if (const char *Encoding =
+ dwarf::AttributeEncodingString(BT.getEncoding()))
+ O << Encoding;
+ else
+ O << "unknown-encoding(" << BT.getEncoding() << ')';
+ } else {
+ O << ' ';
+ if (const char *Tag = dwarf::TagString(T.getTag()))
+ O << Tag;
+ else
+ O << "unknown-tag(" << T.getTag() << ")";
+ }
+ if (T.isCompositeType()) {
+ DICompositeType CT(T.get());
+ if (auto *S = CT.getIdentifier())
+ O << " (identifier: '" << S->getString() << "')";
+ }
O << '\n';
}
}