]> granicus.if.org Git - clang/commitdiff
Revert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
authorJordan Rose <jordan_rose@apple.com>
Sat, 29 Sep 2012 01:36:42 +0000 (01:36 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 29 Sep 2012 01:36:42 +0000 (01:36 +0000)
This reverts commit 580cd17f256259f39a382e967173f34d68e73859.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164875 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/array-struct-region.cpp
test/Analysis/ctor-inlining.mm

index 2e460b79e7dca8b44b8739cdb1957f04eca99900..eb5395e93c7785fad3f33fb1cefdc70cdab2b04f 100644 (file)
@@ -160,14 +160,7 @@ void ExprEngine::processCallExit(ExplodedNode *CEBNode) {
         svalBuilder.getCXXThis(CCE->getConstructor()->getParent(), calleeCtx);
       SVal ThisV = state->getSVal(This);
 
-      // If the constructed object is a prvalue, get its bindings.
-      // Note that we have to be careful here because constructors embedded
-      // in DeclStmts are not marked as lvalues.
-      if (!CCE->isGLValue())
-        if (const MemRegion *MR = ThisV.getAsRegion())
-          if (isa<CXXTempObjectRegion>(MR))
-            ThisV = state->getSVal(cast<Loc>(ThisV));
-
+      // Always bind the region to the CXXConstructExpr.
       state = state->BindExpr(CCE, callerCtx, ThisV);
     }
   }
index e7fbe4d9870ef32c2dd04c20953a46a9b2ce761c..22fbf2ff33b185682c8742037e1cecb4db802e0a 100644 (file)
@@ -61,6 +61,12 @@ int getAssignedField(struct S s) {
 
 void testArgument() {
   clang_analyzer_eval(getConstrainedField(getS()) == 42); // expected-warning{{TRUE}}
+#if __cplusplus
+  // FIXME: Passing the struct by value seems to be confusing C++.
+  // Possibly related to <rdar://problem/12137950>.
+  // expected-warning@-4{{UNKNOWN}}
+#endif
+
   clang_analyzer_eval(getAssignedField(getS()) == 42); // expected-warning{{TRUE}}
 }
 
index ac963e5d9b0992e2118a06f3d2bd3b857159c1f8..918de0a4563ad663cf4d17810ca384d301ef7d8f 100644 (file)
@@ -103,17 +103,3 @@ namespace TemporaryConstructor {
       return;
   }
 }
-
-
-namespace ConstructorUsedAsRValue {
-  using TemporaryConstructor::BoolWrapper;
-
-  bool extractValue(BoolWrapper b) {
-    return b.value;
-  }
-
-  void test() {
-    bool result = extractValue(BoolWrapper());
-    clang_analyzer_eval(result); // expected-warning{{TRUE}}
-  }
-}