xazax.hun added a comment.

Thanks for working on this, please see one of my concerns inline.

If you are trying to fix this problem, alternatively, you could also fix it in 
Clang.

Richard outlined the best possible way to solve this class of errors by 
introducing a new type of AST node in: https://reviews.llvm.org/D46234



================
Comment at: clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp:62
   Finder->addMatcher(
-      ifStmt(stmt().bind("if"),
+      ifStmt(unless(allOf(isConstexpr(), isInTemplateInstantiation())),
+             stmt().bind("if"),
----------------
Why do we care if we are inside a template instantiation? 

Couldn't we trigger the bug with something like:
```
void shouldPass() {
  if constexpr (constexprFun(1) == 0) {
    handle(0);
  } else if constexpr (constexprFun(1)  == 1) {
    handle(1);
  } else {
    handle(2);
  }
}
```

?


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

https://reviews.llvm.org/D71980



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to