xazax.hun added inline comments. ================ Comment at: lib/StaticAnalyzer/Core/MemRegion.cpp:586 @@ +585,3 @@ + return ""; + return nd->getName(); +} ---------------- Alexander_Droste wrote: > Isn't calling `getDecl()` and `getName()` afterwards identical to > `printPretty()`? > Is it possible that a `NamedDecl` cannot be obtained from a `DeclRegion`? The printPretty function copy the name of the variable. First I wanted to avoid any copy and memory allocation, but I realized this utility will probably only be used for diagnostics which is the exceptional case, I think allocations should not cause any performance problem here.
But you are right printPretty is almost identical except for FieldRegions, where it also try to print the super region. I checked and DeclRegion has 3 superclasses, all of them should contain NamedDecls, so that check should never fail. ================ Comment at: lib/StaticAnalyzer/Core/MemRegion.cpp:588 @@ -576,1 +587,3 @@ +} + void MemRegion::printPretty(raw_ostream &os) const { ---------------- Alexander_Droste wrote: > Regarding the MPI-Checker patch http://reviews.llvm.org/D12761 it is > insufficient > if the array index (if obtainable) is not provided. > I think it would be nice if a `getVariableName` function could always provide > as much > information as possible, regarding the passed memory region. Do you actually > see a case in > the other implementation where this function fails? > The index is a member variable of the `ElementRegion` why obtaining that > value cannot fail. If the memory region passed is no `ElementRegion` then > simply `printPretty()` is called. I could submit the patch right away if this > helps. > > > In this case I think you should commit your version. http://reviews.llvm.org/D15924 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits