vsavchenko added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp:167
 
+  const bool isParm = VD->getKind() == Decl::ParmVar;
+  // Reference parameters are assumed as escaped variables.
----------------
`getKind` function is only an implementation detail for `isa`/`cast`/`dan_cast` 
functions ([[ 
https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates
 | docs ]]).  So, this condition would be better in the following form: 
`isa<ParmVarDecl>(VD)`.

NOTE: One good motivation here is that //maybe// in the future there will be 
some sort of new type of function parameters and it will be derived from 
`ParmVarDecl`.  In this situation, direct comparison with the kind of node will 
not work and probably won't be fixed by developers who introduced the new node, 
but `isa` approach will stay correct.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80171



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

Reply via email to