computing or approximating the absolute contribution to the task's .text segment by a library

Consider a single set of C++ source code/header pairs that comprise a library. Very broadly speaking the emitted LLVM code falls into two distinct categories,

  1. code unique to the source code set
  2. calls to other code sets

Has anybody done a LLVM pass in which one estimates the percentage of code in (1) vs (2)?

In large refactoring efforts of complicated code esp. which uses a lot of frameworks, it’s difficult to assess if the library’s large .text size is due to (1) or (2). Templates somewhat complicate things. Having foreknowledge here can help people best focus on the real bloaters without linking the task in all possible combinations.

Off hand calls to ``external" code that which does not appear in the .cpp/.h pair (up to and excluding calls reference’d in #includes) is already marked external by LLVM. So it seems like it is feasible. And in terms of making the percentage estimates (since a LLVM file is ASCII) I suppose one could start with LOC in (1) divided by the total number of LLVM lines. Is there a smarter way to approach?

G Miller