steakhal marked 5 inline comments as done.
steakhal added a comment.

In D72035#1889320 <https://reviews.llvm.org/D72035#1889320>, @Szelethus wrote:

> Wow. Its a joy to see you do C++. LGTM. Are you planning to introduce 
> `CallDescriptionMap` at one point? :)


Yes, definitely.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:492-509
+    const auto OneOf = [FDecl](const auto &... Name) {
+      // FIXME: use fold expression in C++17
+      using unused = int[];
+      bool ret = false;
+      static_cast<void>(unused{
+          0, (ret |= CheckerContext::isCLibraryFunction(FDecl, Name), 0)...});
+      return ret;
----------------
Szelethus wrote:
> Whoa, this is amazing, but looks like a google interview question or 
> something -- is this a technique I should know about it? I feel like we kinda 
> sacrificed readability for coolness.
Actually, I agree but still convinced that it is the future-compatible way of 
doing this.
```lang=c++
    const auto OneOf = [FDecl](const auto &... Name) {
      // FIXME: use fold expression in C++17
      using unused = int[];
      bool ret = false;
      static_cast<void>(unused{
          0, (ret |= CheckerContext::isCLibraryFunction(FDecl, Name), 0)...});
      return ret;
    };
```
In C++17 using fold expressions the whole lambda could be implemented such a 
way:
```lang=c++
    const auto OneOf = [FDecl](const auto &... Name) {
      return (CheckerContext::isCLibraryFunction(FDecl, Name) || ...);
    };
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72035



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

Reply via email to