diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-06-26 01:45:07 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-06-26 01:45:07 +0000 |
| commit | c912e4c787ae01a34fa48576e099fcb5950dd828 (patch) | |
| tree | 9b080c3726d35252f76dc40cc9fa021f69f28a40 /lib/CodeGen/CodeGenModule.h | |
| parent | 5b3552f7879b2eec0cd69d282b6f2b04b73b20e1 (diff) | |
| download | clang-c912e4c787ae01a34fa48576e099fcb5950dd828.tar.gz clang-c912e4c787ae01a34fa48576e099fcb5950dd828.tar.bz2 clang-c912e4c787ae01a34fa48576e099fcb5950dd828.tar.xz | |
CodeGen: Improve warnings about uninstrumented files when profiling
Improve the warning when building with -fprofile-instr-use and a file
appears not to have been profiled at all. This keys on whether a
function is defined in the main file or not to avoid false negatives
when one includes a header with functions that have been profiled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
| -rw-r--r-- | lib/CodeGen/CodeGenModule.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 6cb4fc17c5..d96b34eee6 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -218,12 +218,36 @@ struct ARCEntrypoints { }; /// This class records statistics on instrumentation based profiling. -struct InstrProfStats { - InstrProfStats() : Visited(0), Missing(0), Mismatched(0) {} - bool isOutOfDate() { return Missing || Mismatched; } +class InstrProfStats { + uint32_t VisitedInMainFile; + uint32_t MissingInMainFile; uint32_t Visited; uint32_t Missing; uint32_t Mismatched; + +public: + InstrProfStats() + : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0), + Mismatched(0) {} + /// Record that we've visited a function and whether or not that function was + /// in the main source file. + void addVisited(bool MainFile) { + if (MainFile) + ++VisitedInMainFile; + ++Visited; + } + /// Record that a function we've visited has no profile data. + void addMissing(bool MainFile) { + if (MainFile) + ++MissingInMainFile; + ++Missing; + } + /// Record that a function we've visited has mismatched profile data. + void addMismatched(bool MainFile) { ++Mismatched; } + /// Whether or not the stats we've gathered indicate any potential problems. + bool hasDiagnostics() { return Missing || Mismatched; } + /// Report potential problems we've found to \c Diags. + void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile); }; /// This class organizes the cross-function state that is used while generating |
