[PATCH] D32902: [Analyzer] Iterator Checker - Part 7: Support for push and pop operations

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 02:10:28 PDT 2018


baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:1449-1464
+const CXXRecordDecl *getCXXRecordDecl(const MemRegion *Reg) {
+  QualType Type;
+  if (const auto *TVReg = Reg->getAs<TypedValueRegion>()) {
+    Type = TVReg->getValueType();
+  } else if (const auto *SymReg = Reg->getAs<SymbolicRegion>()) {
+    Type = SymReg->getSymbol()->getType();
+  } else {
----------------
NoQ wrote:
> Would `getDynamicTypeInfo()` be of any help?
I changed the function to use `getDynamicTypeInfo()`, but now I had to include a `ProgramStateRef` parameter to the function and to all its callers so it did not become much more simple.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:1477-1530
+bool isPushBackCall(const FunctionDecl *Func) {
+  const auto *IdInfo = Func->getIdentifier();
+  if (!IdInfo)
+    return false;
+  if (Func->getNumParams() != 1)
+    return false;
+  return IdInfo->getName() == "push_back";
----------------
NoQ wrote:
> I guess we should think if we want to use `CallDescription` for these when D48027 lands.
Here we do not need the qualified name.


https://reviews.llvm.org/D32902





More information about the cfe-commits mailing list