diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2020-03-13 08:15:20 -0400 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-03-13 13:44:42 +0100 |
commit | 92f7aebe2d7e03d7d04b4d2f978482268b63aa7f (patch) | |
tree | 0fb9a36f20578ab1a7e39ecd0d75b4ddb4996150 /llvm/lib/Support/Timer.cpp | |
parent | d9bd6e3c1943e03b783f11d9f2e224ff83f83a7b (diff) | |
download | bcm5719-llvm-92f7aebe2d7e03d7d04b4d2f978482268b63aa7f.tar.gz bcm5719-llvm-92f7aebe2d7e03d7d04b4d2f978482268b63aa7f.zip |
[Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler crash
After a crash catched by the CrashRecoveryContext, this patch prevents from accessing dangling pointers in TimerGroup structures before the clang tool exits. Previously, the default TimerGroup had internal linked lists which were still pointing to old Timer or TimerGroup instances, which lived in stack frames released by the CrashRecoveryContext.
Fixes PR45164.
Differential Revision: https://reviews.llvm.org/D76099
(cherry picked from commit 28ad9fc20823678881baa0d723834b88ea9e8e3a)
Diffstat (limited to 'llvm/lib/Support/Timer.cpp')
-rw-r--r-- | llvm/lib/Support/Timer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index 613d2eaae6d..2d3d0081282 100644 --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -441,3 +441,7 @@ const char *TimerGroup::printAllJSONValues(raw_ostream &OS, const char *delim) { void TimerGroup::ConstructTimerLists() { (void)*NamedGroupedTimers; } + +std::unique_ptr<TimerGroup> TimerGroup::aquireDefaultGroup() { + return std::unique_ptr<TimerGroup>(DefaultTimerGroup.claim()); +} |