================
@@ -48,11 +48,17 @@ static int getPrecedence(const BinaryOperator *BinOp) {
     return 0;
   }
 }
-static void addParentheses(const BinaryOperator *BinOp,
-                           const BinaryOperator *ParentBinOp,
+static void addParentheses(const Expr *E, const BinaryOperator *ParentBinOp,
                            ClangTidyCheck *Check,
                            const clang::SourceManager &SM,
                            const clang::LangOptions &LangOpts) {
+  if (const auto *Paren = dyn_cast<ParenExpr>(E)) {
+    addParentheses(Paren->getSubExpr()->IgnoreImpCasts(), nullptr, Check, SM,
----------------
zeyi2 wrote:

I found a crash when testing:

```bash
$ python3 -c "print('int main() { int x = ' + '(' * 5000 + '1' + ')' * 5000 + 
'; }')" > recursive_test.cpp
$ ./build/bin/clang-tidy -checks='-*,readability-math-missing-parentheses' 
recursive_test.cpp
```

It crashed inside `clang::Parser`, this problem is also reproduced in `21.1.6` 
release build.

So I think this problem is unrelated with the modification.

https://github.com/llvm/llvm-project/pull/172423
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to