[PATCH] Initial pass at API design for DebugInfo/PDB
zturner at google.com
Mon Feb 2 15:40:59 PST 2015
As an aside, one thing I actually thought about with regards to the object model was only including 1 method in the base class. the one that gets the symbol tag. Then having each concrete type derive from the base tag and then provide pure virtual methods for the methods that it would support. So instead of having this PDBFunction, for example, which is ultimately just a facade that forwards methods to the underlying monolithic interface, instead have an IPDBFunction whose vtable contains the exact set of methods relevant for a function.
The advantages of this approach is that
1. you can no longer call invalid methods through the IPDBSymbolBase interface.
2. pdb_symbol_cast<> has more natural behavior now. Instead of casting a pointer type to a value type, it actually behaves more like a traditional dynamic cast.
And the disadvantages are:
1. Implementor has to do more work now. It has to implement the same function many times, for example when valid methods overlap.
More information about the llvm-commits