You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
INPUTS
bindings
cmake
docs
examples
include
lib
runtime
tools
unittests
AST
ASTMatchers
Analysis
Basic
CodeGen
CrossTU
Driver
Format
Frontend
Lex
Rename
Rewrite
Sema
StaticAnalyzer
Tooling
ASTSelectionTest.cpp
CMakeLists.txt
CastExprTest.cpp
CommentHandlerTest.cpp
CompilationDatabaseTest.cpp
DiagnosticsYamlTest.cpp
ExecutionTest.cpp
FixItTest.cpp
LexicallyOrderedRecursiveASTVisitorTest.cpp
LookupTest.cpp
QualTypeNamesTest.cpp
RecursiveASTVisitorTest.cpp
RecursiveASTVisitorTestCallVisitor.cpp
RecursiveASTVisitorTestDeclVisitor.cpp
RecursiveASTVisitorTestExprVisitor.cpp
RecursiveASTVisitorTestTypeLocVisitor.cpp
RefactoringActionRulesTest.cpp
RefactoringCallbacksTest.cpp
RefactoringTest.cpp
ReplacementTest.h
ReplacementsYamlTest.cpp
RewriterTest.cpp
RewriterTestContext.h
TestVisitor.h
ToolingTest.cpp
libclang
CMakeLists.txt
utils
www
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
//===- 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");
|
|
}
|
|
|
|
}
|