summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/cfg-rich-constructors.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-02-24 02:07:50 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-02-24 02:07:50 +0000
commit8cc55e9f16ddc19186dd593d2b69b6b43e04d6ac (patch)
tree15eee642d1cde8624b81659efcad6408a02d88b9 /clang/test/Analysis/cfg-rich-constructors.cpp
parentceb7d91a484982cfca84c102cfddb90b3963c46e (diff)
downloadbcm5719-llvm-8cc55e9f16ddc19186dd593d2b69b6b43e04d6ac.tar.gz
bcm5719-llvm-8cc55e9f16ddc19186dd593d2b69b6b43e04d6ac.zip
[CFG] Provide construction contexts for temporaries bound to const references.
In order to bind a temporary to a const lvalue reference, a no-op cast is added to make the temporary itself const, and only then the reference is taken (materialized). Skip the no-op cast when looking for the construction context. Differential Revision: https://reviews.llvm.org/D43481 llvm-svn: 326016
Diffstat (limited to 'clang/test/Analysis/cfg-rich-constructors.cpp')
-rw-r--r--clang/test/Analysis/cfg-rich-constructors.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/test/Analysis/cfg-rich-constructors.cpp b/clang/test/Analysis/cfg-rich-constructors.cpp
index 6333e327b36..6dee2dc4dfb 100644
--- a/clang/test/Analysis/cfg-rich-constructors.cpp
+++ b/clang/test/Analysis/cfg-rich-constructors.cpp
@@ -155,9 +155,8 @@ void referenceVariableWithConstructor() {
const C &c(0);
}
-// TODO: Should find construction target here.
// CHECK: void referenceVariableWithInitializer()
-// CHECK: 1: C() (CXXConstructExpr, class C)
+// CHECK: 1: C() (CXXConstructExpr, [B1.3], class C)
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, NoOp, const class C)
// CHECK-NEXT: 3: [B1.2]
// CHECK-NEXT: 4: const C &c = C();
@@ -335,7 +334,7 @@ public:
};
// CHECK: return_stmt_with_dtor::D returnTemporary()
-// CHECK: 1: return_stmt_with_dtor::D() (CXXConstructExpr, [B1.2], class return_stmt_with_dtor::D)
+// CHECK: 1: return_stmt_with_dtor::D() (CXXConstructExpr, [B1.2], [B1.4], class return_stmt_with_dtor::D)
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const class return_stmt_with_dtor::D)
// CHECK-NEXT: 4: [B1.3]
@@ -418,7 +417,7 @@ void referenceVariableWithConstructor() {
}
// CHECK: void referenceVariableWithInitializer()
-// CHECK: 1: temporary_object_expr_with_dtors::D() (CXXConstructExpr, [B1.2], class temporary_object_expr_with_dtors::D)
+// CHECK: 1: temporary_object_expr_with_dtors::D() (CXXConstructExpr, [B1.2], [B1.4], class temporary_object_expr_with_dtors::D)
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const class temporary_object_expr_with_dtors::D)
// CHECK-NEXT: 4: [B1.3]
@@ -446,7 +445,7 @@ void referenceVariableWithInitializer() {
// CHECK-NEXT: 8: [B5.7] (BindTemporary)
// CHECK: [B6]
// CHECK-NEXT: 1: 0
-// CHECK-NEXT: 2: [B6.1] (CXXConstructExpr, [B6.3], class temporary_object_expr_with_dtors::D)
+// CHECK-NEXT: 2: [B6.1] (CXXConstructExpr, [B6.3], [B6.6], class temporary_object_expr_with_dtors::D)
// CHECK-NEXT: 3: [B6.2] (BindTemporary)
// CHECK-NEXT: 4: temporary_object_expr_with_dtors::D([B6.3]) (CXXFunctionalCastExpr, ConstructorConversion, class temporary_object_expr_with_dtors::D)
// CHECK-NEXT: 5: [B6.4] (ImplicitCastExpr, NoOp, const class temporary_object_expr_with_dtors::D)
OpenPOWER on IntegriCloud