]> granicus.if.org Git - clang/commitdiff
[Parser] Remove hard-coded bracket depth limit
authorJan Korous <jkorous@apple.com>
Fri, 16 Mar 2018 20:17:28 +0000 (20:17 +0000)
committerJan Korous <jkorous@apple.com>
Fri, 16 Mar 2018 20:17:28 +0000 (20:17 +0000)
The diagnostics produced if assert fails are using proper limit from language definition already.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327735 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/RAIIObjectsForParser.h
lib/Parse/Parser.cpp

index acaeb442a21ad3a023e5e08d4d3de5164e10ec8c..9a9453b4c31364293b325a3ae9cc3913db09ed93 100644 (file)
@@ -378,8 +378,6 @@ namespace clang {
       }
     }
     
-    enum { MaxDepth = 256 };
-    
     bool diagnoseOverflow();
     bool diagnoseMissingClose();
     
index f617d240b0927fea3e3dfbd7db73e8ed0e6de653..d8f9f7a390257dfec42a95f7190bb8c1e3525585 100644 (file)
@@ -2250,7 +2250,7 @@ bool BalancedDelimiterTracker::expectAndConsume(unsigned DiagID,
     return true;
   }
 
-  if (getDepth() < MaxDepth)
+  if (getDepth() < P.getLangOpts().BracketDepth)
     return false;
     
   return diagnoseOverflow();