diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 17:59:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 17:59:23 +0000 |
commit | 9a83721404652cea39e9f02ae3e3b5c964602a5c (patch) | |
tree | 23e9541ce27049a103f6ed046be61592123e02c9 /unittests/Tooling/CastExprTest.cpp | |
parent | 676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (diff) |
Notes
Diffstat (limited to 'unittests/Tooling/CastExprTest.cpp')
-rw-r--r-- | unittests/Tooling/CastExprTest.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/unittests/Tooling/CastExprTest.cpp b/unittests/Tooling/CastExprTest.cpp deleted file mode 100644 index 5310c21254724..0000000000000 --- a/unittests/Tooling/CastExprTest.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===- unittest/Tooling/CastExprTest.cpp ----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "TestVisitor.h" - -using namespace clang; - -namespace { - -struct CastExprVisitor : TestVisitor<CastExprVisitor> { - std::function<void(ExplicitCastExpr *)> OnExplicitCast; - - bool VisitExplicitCastExpr(ExplicitCastExpr *Expr) { - if (OnExplicitCast) - OnExplicitCast(Expr); - return true; - } -}; - -TEST(CastExprTest, GetSubExprAsWrittenThroughMaterializedTemporary) { - CastExprVisitor Visitor; - Visitor.OnExplicitCast = [](ExplicitCastExpr *Expr) { - auto Sub = Expr->getSubExprAsWritten(); - EXPECT_TRUE(isa<DeclRefExpr>(Sub)) - << "Expected DeclRefExpr, but saw " << Sub->getStmtClassName(); - }; - Visitor.runOver("struct S1 {};\n" - "struct S2 { operator S1(); };\n" - "S1 f(S2 s) { return static_cast<S1>(s); }\n"); -} - -} |