[PATCH] D12381: [Static Analyzer] Merge the Objective-C Generics Checker into Dynamic Type Propagation checker.

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 10:16:13 PDT 2015


xazax.hun marked an inline comment as not done.

================
Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:81
@@ +80,3 @@
+    initBugType();
+    SmallString<64> Buf;
+    llvm::raw_svector_ostream OS(Buf);
----------------
zaks.anna wrote:
> How do we know that the string is big enough?
When the string is not big enough, there will be an allocation. So this is not a correctness issue. However I checked that, and the error messages tend to be very long. I could either increase the size of this smallstring to something like 150 which should be enough for the common of the cases, or I could just make it a string. Which one do you prefer?

================
Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:179
@@ -178,3 @@
-  // We only track dynamic type info for regions.
-  const MemRegion *ToR = C.getSVal(CastE).getAsRegion();
-  if (!ToR)
----------------
zaks.anna wrote:
> This line used to be unconditional and now, it's only executed if we are casting between ObjC Types.
It should not be a problem. The code bellow only executes for bitcasts, and getBetterObjCType only returns a valid value, when the cast was between Obj-C types.

================
Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:407
@@ +406,3 @@
+// Clean up the states stored by the generics checker.
+void DynamicTypePropagation::checkDeadSymbols(SymbolReaper &SR,
+                                              CheckerContext &C) const {
----------------
zaks.anna wrote:
> Do you know if the info tracked by the DynamicTypeInfo checker gets cleaned up for dead symbols?
That information is stored in DynamicTypeMap which is populated in lib/StaticAnalyzer/Core/ProgramState.cpp

I could not find any cleanup code. What do you think, what would be the best way to do the cleanup. Exposing a removeDynamicTypeInfo method from the ProgramState does not seem to be elegant, but it would work.


http://reviews.llvm.org/D12381





More information about the cfe-commits mailing list