[cfe-commits] [PATCH][Review request]PreVisitDeclStmt for aggregate initializers

Jim Goodnow II jim at thegoodnows.net
Wed Oct 13 02:35:21 PDT 2010


PreVisitDeclStmt wasn't getting called for C++ aggregate initializers.

  - jim

Index: lib/Checker/GRExprEngine.cpp
===================================================================
--- lib/Checker/GRExprEngine.cpp	(revision 115801)
+++ lib/Checker/GRExprEngine.cpp	(working copy)
@@ -2682,7 +2682,12 @@
      if (getContext().getLangOptions().CPlusPlus && InitTy->isRecordType()) {
        // Delegate expressions of C++ record type evaluation to 
AggExprVisitor.
        VisitAggExpr(InitEx, GetState(Pred)->getLValue(VD,
-                                       Pred->getLocationContext()), 
Pred, Dst);
+                                       Pred->getLocationContext()), 
Pred, Tmp);
+      // FIXME: remove later when all paths through VisitAggExpr work properly
+      if (Tmp.empty())
+        Tmp.Add(Pred);
+      // call checkers for initialized aggregates
+      CheckerVisit(DS, Dst, Tmp, PreVisitStmtCallback);
        return;
      } else if (VD->getType()->isReferenceType())
        VisitLValue(InitEx, Pred, Tmp);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VisitDecl.patch
Type: application/octet-stream
Size: 944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20101013/21d65c28/attachment.obj>


More information about the cfe-commits mailing list