[PATCH] D62947: [clang-tidy] Fix an assertion failure in misc-redundant-expression.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 05:55:47 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL362701: [clang-tidy] Fix an assertion failure in misc-redundant-expression. (authored by hokein, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62947?vs=203331&id=203336#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62947/new/

https://reviews.llvm.org/D62947

Files:
  clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp


Index: clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-redundant-expression.cpp
@@ -725,3 +725,15 @@
 #undef FLAG1
 #undef FLAG2
 #undef FLAG3
+
+namespace no_crash {
+struct Foo {};
+bool operator<(const Foo&, const Foo&);
+template <class T>
+struct Bar {
+  static const Foo &GetFoo();
+  static bool Test(const T & maybe_foo, const Foo& foo) {
+    return foo < GetFoo() && foo < maybe_foo;
+  }
+};
+}
Index: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
@@ -291,7 +291,7 @@
 }
 
 AST_MATCHER(Expr, isIntegerConstantExpr) {
-  if (Node.isInstantiationDependent())
+  if (Node.isInstantiationDependent() || Node.isValueDependent())
     return false;
   return Node.isIntegerConstantExpr(Finder->getASTContext());
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62947.203336.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190606/e75bb73e/attachment.bin>


More information about the cfe-commits mailing list