[PATCH] D82425: [SemaCXX] Fix false positive of -Wuninitialized-const-reference in empty function body.

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 16:20:12 PDT 2020


zequanwu marked 2 inline comments as done.
zequanwu added inline comments.


================
Comment at: clang/lib/Analysis/UninitializedValues.cpp:435
       if ((*I)->getType().isConstQualified())
-        classify((*I), ConstRefUse);
+        if (!hasTrivialBody(CE))
+          classify((*I), ConstRefUse);
----------------
aaron.ballman wrote:
> This can be hoisted out of the loop so that we don't have to check the same thing on every argument.
The `DeclRefExpr` needs to be set to `Ignore` like `VisitCastExpr` does. Otherwise, it maybe classified to `Init` by `isTrackedVar` in `ClassifyRefs::get`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82425





More information about the cfe-commits mailing list