diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -12950,7 +12950,8 @@ // expression or statement in the body of the function [and thus before // the value computation of its result]. SequencedSubexpression Sequenced(*this); - Base::VisitCallExpr(CE); + SemaRef.runWithSufficientStackSpace(CE->getExprLoc(), + [&] { Base::VisitCallExpr(CE); }); // FIXME: CXXNewExpr and CXXDeleteExpr implicitly call functions. } diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -3595,6 +3595,7 @@ const char *const *command_line_args, int num_command_line_args, struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, unsigned options, CXTranslationUnit *out_TU) { + noteBottomOfStack(); SmallVector Args; Args.push_back("clang"); Args.append(command_line_args, command_line_args + num_command_line_args); @@ -3619,6 +3620,7 @@ CXErrorCode result = CXError_Failure; auto ParseTranslationUnitImpl = [=, &result] { + noteBottomOfStack(); result = clang_parseTranslationUnit_Impl( CIdx, source_filename, command_line_args, num_command_line_args, llvm::makeArrayRef(unsaved_files, num_unsaved_files), options, out_TU); @@ -6622,9 +6624,10 @@ void clang_executeOnThread(void (*fn)(void*), void *user_data, unsigned stack_size) { - llvm::llvm_execute_on_thread( - fn, user_data, - stack_size == 0 ? llvm::None : llvm::Optional(stack_size)); + llvm::llvm_execute_on_thread(fn, user_data, + stack_size == 0 + ? clang::DesiredStackSize + : llvm::Optional(stack_size)); } //===----------------------------------------------------------------------===//