[clang] 471d060 - [CIndex] Fix annotate-deep-statements test when using a Debug build

Alexandre Ganea via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 29 07:52:32 PST 2019


Author: Alexandre Ganea
Date: 2019-11-29T10:52:20-05:00
New Revision: 471d06020a6a12c621131c508e58878890db3906

URL: https://github.com/llvm/llvm-project/commit/471d06020a6a12c621131c508e58878890db3906
DIFF: https://github.com/llvm/llvm-project/commit/471d06020a6a12c621131c508e58878890db3906.diff

LOG: [CIndex] Fix annotate-deep-statements test when using a Debug build

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

Added: 
    

Modified: 
    clang/lib/Sema/SemaChecking.cpp
    clang/tools/libclang/CIndex.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index adefca7fe4e7..ed42833531d4 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -12950,7 +12950,8 @@ class SequenceChecker : public EvaluatedExprVisitor<SequenceChecker> {
     //   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
index 2078e4719522..a8222356db44 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -3595,6 +3595,7 @@ enum CXErrorCode clang_parseTranslationUnit2(
     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<const char *, 4> Args;
   Args.push_back("clang");
   Args.append(command_line_args, command_line_args + num_command_line_args);
@@ -3619,6 +3620,7 @@ enum CXErrorCode clang_parseTranslationUnit2FullArgv(
 
   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_enableStackTraces(void) {
 
 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<unsigned>(stack_size));
+  llvm::llvm_execute_on_thread(fn, user_data,
+                               stack_size == 0
+                                   ? clang::DesiredStackSize
+                                   : llvm::Optional<unsigned>(stack_size));
 }
 
 //===----------------------------------------------------------------------===//


        


More information about the cfe-commits mailing list