diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2012-03-13 21:02:14 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-13 21:02:14 +0000 |
| commit | c7c0089b444a34376a31fc1e8ae10c88167d64cd (patch) | |
| tree | 20d7253cb10cf7946ef6473e3fbd5364e492929f /clang/lib/Basic | |
| parent | 615fd897e0b09ebe8c730bfee23ac5e4e5d561aa (diff) | |
| download | bcm5719-llvm-c7c0089b444a34376a31fc1e8ae10c88167d64cd.tar.gz bcm5719-llvm-c7c0089b444a34376a31fc1e8ae10c88167d64cd.zip | |
[Basic] Fix up DiagnosticBuilder::{FlushCounts,Emit} to be inline.
- This is much more important than it appears at first glance...
The intended design of DiagnosticBuilder was that it never escape and that all
its members would get lowered to registers by the compiler. By fixing Emit here,
the compiler can completely eliminate the DiagnosticBuilder object and never
need to push those registers back into it.
Unfortunately, Sema has broken DiagnosticBuilder in other ways (by introducing
SemaDiagnosticBuilder), so we don't get the fill impact of this, but it is still
good for 30k reduction in code size. I'll work on fixing the
SemaDiagnosticBuilder problems next.
llvm-svn: 152669
Diffstat (limited to 'clang/lib/Basic')
| -rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index a36f3ce38a1..f7d5d87b367 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -385,35 +385,18 @@ void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) { CurDiagID = ~0U; } -void DiagnosticBuilder::FlushCounts() { - DiagObj->NumDiagArgs = NumArgs; - DiagObj->NumDiagRanges = NumRanges; - DiagObj->NumDiagFixItHints = NumFixits; -} - -bool DiagnosticBuilder::Emit() { - // If DiagObj is null, then its soul was stolen by the copy ctor - // or the user called Emit(). - if (DiagObj == 0) return false; - - // When emitting diagnostics, we set the final argument count into - // the DiagnosticsEngine object. - FlushCounts(); - +bool DiagnosticsEngine::EmitCurrentDiagnostic() { // Process the diagnostic, sending the accumulated information to the // DiagnosticConsumer. - bool Emitted = DiagObj->ProcessDiag(); + bool Emitted = ProcessDiag(); // Clear out the current diagnostic object. - unsigned DiagID = DiagObj->CurDiagID; - DiagObj->Clear(); + unsigned DiagID = CurDiagID; + Clear(); // If there was a delayed diagnostic, emit it now. - if (DiagObj->DelayedDiagID && DiagObj->DelayedDiagID != DiagID) - DiagObj->ReportDelayed(); - - // This diagnostic is dead. - DiagObj = 0; + if (DelayedDiagID && DelayedDiagID != DiagID) + ReportDelayed(); return Emitted; } |

