llvm-project/clang/test
Richard Smith 26a92d5852 Improve behavior in the case of stack exhaustion.
Summary:
Clang performs various recursive operations (such as template instantiation),
and may use non-trivial amounts of stack space in each recursive step (for
instance, due to recursive AST walks). While we try to keep the stack space
used by such steps to a minimum and we have explicit limits on the number of
such steps we perform, it's impractical to guarantee that we won't blow out the
stack on deeply recursive template instantiations on complex ASTs, even with
only a moderately high instantiation depth limit.

The user experience in these cases is generally terrible: we crash with
no hint of what went wrong. Under this patch, we attempt to do better:

 * Detect when the stack is nearly exhausted, and produce a warning with a
   nice template instantiation backtrace, telling the user that we might
   run slowly or crash.

 * For cases where we're forced to trigger recursive template
   instantiation in arbitrarily-deeply-nested contexts, check whether
   we're nearly out of stack space and allocate a new stack (by spawning
   a new thread) after producing the warning.

Reviewers: rnk, aaron.ballman

Subscribers: mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66361

llvm-svn: 369940
2019-08-26 18:18:07 +00:00
..
ARCMT
AST [ASTDump] Add is_anonymous to VisitCXXRecordDecl 2019-08-12 17:07:49 +00:00
ASTMerge Give the 'signed/unsigned wchar_t' extension a warning flag, and follow 2019-07-29 20:00:46 +00:00
Analysis [analyzer] Avoid unnecessary enum range check on LValueToRValue casts 2019-08-23 14:21:13 +00:00
CXX PR40674: fix assertion failure if a structured binding declaration has a 2019-08-24 01:23:57 +00:00
ClangScanDeps clang-scan-deps: do not spawn threads when LLVM_ENABLE_THREADS is disabled 2019-08-13 00:36:35 +00:00
CodeCompletion
CodeGen NFC: Rename some sanitizer related lifetime checks 2019-08-24 01:31:38 +00:00
CodeGenCUDA IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
CodeGenCXX [Testing] Unbreak r369830 2019-08-24 08:12:51 +00:00
CodeGenCoroutines Remove unreachable blocks before splitting a coroutine. 2019-08-14 03:54:13 +00:00
CodeGenObjC Add SVE opaque built-in types 2019-08-09 08:52:54 +00:00
CodeGenObjCXX IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
CodeGenOpenCL Builtins: Start adding half versions of math builtins 2019-08-06 03:28:37 +00:00
CodeGenOpenCLCXX Make the CXXABIs respect the target's default calling convention. 2019-07-26 12:36:12 +00:00
Coverage
CoverageMapping Remove cache for macro arg stringization 2019-07-30 17:58:22 +00:00
Driver [driver] add a new option `-gen-cdb-fragment-path` to emit 2019-08-26 17:59:41 +00:00
FixIt [Sema] Don't warn on printf('%hd', [char]) (PR41467) 2019-08-23 18:01:57 +00:00
Format
Frontend Reland "[ARM] push LR before __gnu_mcount_nc" 2019-08-16 23:30:16 +00:00
Headers [PowerPC] [Clang] Port SSE3, SSSE3 and SSE4 intrinsics to PowerPC 2019-08-09 03:39:55 +00:00
Import
Index [libclang][index][NFC] Fix test for skipping already parsed function bodies 2019-08-23 22:51:23 +00:00
Integration
InterfaceStubs [clang][ifs] Dropping older experimental interface stub formats. 2019-08-22 23:44:34 +00:00
Layout
Lexer Implement P1668R1 2019-08-19 17:39:59 +00:00
Misc [NewPM][PassInstrumentation] IR printing support from clang driver 2019-08-14 07:11:09 +00:00
Modules
OpenMP [OPENMP5]Use nonmonotonic modifier by default for non-static and 2019-08-23 19:52:05 +00:00
PCH Rename PCH/leakfiles test so it runs on bots. 2019-08-09 17:13:56 +00:00
Parser [Parser] Emit descriptive diagnostic for misplaced pragma 2019-08-04 10:08:51 +00:00
Preprocessor Allow standards-based attributes to have leading and trailing underscores. 2019-08-15 18:35:44 +00:00
Profile [PGO] Fix bolt failures from r367628 2019-08-02 07:21:50 +00:00
Refactor [Tooling] Added DeclStmtClass to ExtractionSemicolonPolicy 2019-08-14 13:37:39 +00:00
Rewriter
Sema [Wdocumentation] improve wording of a warning message 2019-08-25 18:20:18 +00:00
SemaCUDA
SemaCXX PR42513: Enter the proper DeclContext before substituting into an 2019-08-24 02:30:00 +00:00
SemaObjC [Sema][ObjC] Fix a -Wformat false positive with localizedStringForKey 2019-08-14 16:57:11 +00:00
SemaObjCXX
SemaOpenCL [OpenCL] Add const, volatile and pointer builtin handling 2019-08-20 12:21:03 +00:00
SemaOpenCLCXX [OpenCL] Fix addr space deduction for pointers/references to arrays. 2019-08-19 11:43:16 +00:00
SemaTemplate Improve behavior in the case of stack exhaustion. 2019-08-26 18:18:07 +00:00
TableGen
Templight
Tooling
Unit
VFS Introduce FileEntryRef and use it when handling includes to report correct dependencies 2019-08-22 18:15:50 +00:00
clang-rename
.clang-format
CMakeLists.txt Improve behavior in the case of stack exhaustion. 2019-08-26 18:18:07 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg.py Improve behavior in the case of stack exhaustion. 2019-08-26 18:18:07 +00:00
lit.site.cfg.py.in Improve behavior in the case of stack exhaustion. 2019-08-26 18:18:07 +00:00
make_test_dirs.pl