]> granicus.if.org Git - clang/commitdiff
Improve C++ constructor handling.
authorZhongxing Xu <xuzhongxing@gmail.com>
Thu, 1 Apr 2010 03:47:27 +0000 (03:47 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Thu, 1 Apr 2010 03:47:27 +0000 (03:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100080 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/AggExprVisitor.cpp
lib/Checker/GRExprEngine.cpp

index 5f55ab869c2de66d23dc833b4ce73fc81f1fbcf1..343afec18d21f35bd4027340427cca09e9d04c56 100644 (file)
@@ -38,6 +38,7 @@ void AggExprVisitor::VisitCastExpr(CastExpr *E) {
   switch (E->getCastKind()) {
   default: 
     assert(0 && "Unhandled cast kind");
+  case CastExpr::CK_NoOp:
   case CastExpr::CK_ConstructorConversion:
     Visit(E->getSubExpr());
     break;
index 04f8cc6142cb86f5bf6c475b618b5d769f6ca13b..2e40a934708087b3971bffd5036ead7bbf21565c 100644 (file)
@@ -2363,8 +2363,10 @@ void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
   ExplodedNodeSet Tmp;
 
   if (InitEx) {
-    if (const CXXConstructExpr *E = dyn_cast<CXXConstructExpr>(InitEx)) {
-      VisitCXXConstructExpr(E, GetState(Pred)->getLValue(VD,
+    QualType InitTy = InitEx->getType();
+    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);
       return;
     } else if (VD->getType()->isReferenceType())