[PATCH] Add llvm-pdbdump to tools
Reid Kleckner
rnk at google.com
Mon Jan 26 11:03:31 PST 2015
lgtm, if we remove use of lib/Support/Windows functions
================
Comment at: tools/llvm-pdbdump/llvm-pdbdump.cpp:45-48
@@ +44,6 @@
+namespace windows {
+extern std::error_code UTF8ToUTF16(StringRef utf8,
+ SmallVectorImpl<wchar_t> &utf16);
+extern std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len,
+ SmallVectorImpl<char> &utf8);
+}
----------------
I'd rather not manually prototype private implementation details of lib/Support/Windows. We have an equivalent of one of these called `convertUTF16ToUTF8String` that's public, and we should just implement the equivalent operation in the other direction. Let me go write that real quick...
================
Comment at: tools/llvm-pdbdump/llvm-pdbdump.cpp:72
@@ +71,3 @@
+ CComPtr<IDiaEnumDebugStreams> DebugStreams = nullptr;
+ if (SUCCEEDED(session->getEnumDebugStreams(&DebugStreams))) {
+ LONG Count = 0;
----------------
You can exit early here. I doubt you need to flush when you don't print anything.
================
Comment at: tools/llvm-pdbdump/llvm-pdbdump.cpp:87
@@ +86,3 @@
+ ::SysFreeString(Name16);
+ if (SUCCEEDED(Stream->get_Count(&Count))) {
+ outs() << " [" << Count << " records]\n";
----------------
Generally LLVM encourages early exit to reduce indentation, so you could invert this to:
if (!SUCCEEDED(Stream->get_Count(&Count)) {
outs() << '\n';
continue;
}
// success case with reduced indentation
http://reviews.llvm.org/D7153
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list