[Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler...
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Fri, 13 Mar 2020 12:15:20 +0000 (08:15 -0400)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Fri, 13 Mar 2020 12:15:35 +0000 (08:15 -0400)
commit28ad9fc20823678881baa0d723834b88ea9e8e3a
treeb26f112389a47c6bd53d3568abc015a96b5df36b
parent0ffb12ca67fd813a8ae840399626dd5f8fea3178
[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
clang/lib/Lex/Pragma.cpp
clang/tools/driver/driver.cpp
llvm/include/llvm/Support/ManagedStatic.h
llvm/include/llvm/Support/Timer.h
llvm/lib/Support/Timer.cpp