[PATCH] Initial pass at API design for DebugInfo/PDB

David Blaikie dblaikie at gmail.com
Tue Feb 3 11:25:48 PST 2015


================
Comment at: include/llvm/DebugInfo/PDB/PDBCasting.h:28
@@ +27,3 @@
+
+template <> bool pdb_symbol_isa<PDBExecutable>(PDBSymbolPtr Symbol) {
+  return Symbol->getSymTag() == PDB_SymType::Executable;
----------------
This cast machinery seems a bit confusing owing to the mix of pointers and value types. (& you mention in the summary that you can also use the traditional llvm::*cast machinery too? That would be odd as well - to cast to concrete types from pointer types)

One other way that PDBFunction et, al could be implemented that might be more natural (& require less of this machinery) - make PDBSymbol opaque (virtual dtor, no other functions) and have various PDBFunction/etc derive from that. Use LLVM's standard cast machinery here. Implement them in terms of a PDBRawSymbol/PDBSymbolImpl, something like that (which would be what your current PDBSymbol is) - maybe the base opaque PDBSymbol could have a non-virtual "getRaw/getImpl/whatever" to access the raw thing when desired (in dumpers, etc).

I just hesitate to add more 'odd' casting machinery - we already stretch that idiom a bit further than I think is helpful with some of our hierarchies.

================
Comment at: lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp:21
@@ +20,3 @@
+
+IPDBSession::IPDBSession() {}
+
----------------
I don't think you need an out-of-line ctor /and/ dtor, just the dtor would be fine - and maybe a comment about these dtors being anchors.

http://reviews.llvm.org/D7356

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list