[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 06:41:32 PDT 2018


JonasToth added a comment.

The `std::move` as cast is a follow up patch?

>From my side only the nits are left.



================
Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:333
+    const auto *Parm = Nodes.getNodeAs<ParmVarDecl>("parm");
+    const auto AllParams =
+        Func->getPrimaryTemplate()->getTemplatedDecl()->parameters();
----------------
Please spell out the type here


================
Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:339
+            ->getType();
+    if (auto *T = ParmType->getAs<PackExpansionType>())
+      ParmType = T->getPattern();
----------------
could `T` be a const pointer?


================
Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:344
+    // definition and see whether the param is mutated inside.
+    if (auto *RefType = ParmType->getAs<RValueReferenceType>()) {
+      if (!RefType->getPointeeType().getQualifiers() &&
----------------
could `RefType` be a const pointer?


================
Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:347
+          RefType->getPointeeType()->getAs<TemplateTypeParmType>()) {
+        auto &Analyzer = FuncParmAnalyzer[Func];
+        if (!Analyzer)
----------------
Please spell out the type here


================
Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:381
+FunctionParmMutationAnalyzer::findMutation(const ParmVarDecl *Parm) {
+  const auto Memoized = Results.find(Parm);
+  if (Memoized != Results.end())
----------------
Please spell out the type here


Repository:
  rC Clang

https://reviews.llvm.org/D52008





More information about the cfe-commits mailing list