Skip to content

Commit 4ec28eb

Browse files
committed
Apply review suggestions
1 parent 55645b1 commit 4ec28eb

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

include/clang/Interpreter/CppInterOp.h

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ namespace Cpp {
7777
/// function, constructor or destructor.
7878
class JitCall {
7979
public:
80-
friend CPPINTEROP_API JitCall MakeFunctionCallable(TCppConstFunction_t);
8180
friend CPPINTEROP_API JitCall
8281
MakeFunctionCallable(TInterp_t I, TCppConstFunction_t func);
8382
enum Kind : char {

lib/Interpreter/CppInterOp.cpp

+9-11
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ namespace Cpp {
857857

858858
TCppIndex_t GetFunctionRequiredArgs(TCppConstFunction_t func)
859859
{
860-
auto *D = (const clang::Decl *) func;
860+
const auto* D = static_cast<const clang::Decl*>(func);
861861
if (auto* FD = llvm::dyn_cast_or_null<FunctionDecl>(D))
862862
return FD->getMinRequiredArguments();
863863

@@ -923,7 +923,8 @@ namespace Cpp {
923923
}
924924

925925
bool IsFunctionDeleted(TCppConstFunction_t function) {
926-
auto *FD = cast<const FunctionDecl>((const clang::Decl*)function);
926+
const auto* FD =
927+
cast<const FunctionDecl>(static_cast<const clang::Decl*>(function));
927928
return FD->isDeleted();
928929
}
929930

@@ -1054,7 +1055,8 @@ namespace Cpp {
10541055

10551056
bool IsMethod(TCppConstFunction_t method)
10561057
{
1057-
return dyn_cast_or_null<CXXMethodDecl>((const clang::Decl*)method);
1058+
return dyn_cast_or_null<CXXMethodDecl>(
1059+
static_cast<const clang::Decl*>(method));
10581060
}
10591061

10601062
bool IsPublicMethod(TCppFunction_t method)
@@ -1073,18 +1075,18 @@ namespace Cpp {
10731075

10741076
bool IsConstructor(TCppConstFunction_t method)
10751077
{
1076-
auto *D = (const Decl *) method;
1078+
const auto* D = static_cast<const Decl*>(method);
10771079
return llvm::isa_and_nonnull<CXXConstructorDecl>(D);
10781080
}
10791081

10801082
bool IsDestructor(TCppConstFunction_t method)
10811083
{
1082-
auto *D = (const Decl *) method;
1084+
const auto* D = static_cast<const Decl*>(method);
10831085
return llvm::isa_and_nonnull<CXXDestructorDecl>(D);
10841086
}
10851087

10861088
bool IsStaticMethod(TCppConstFunction_t method) {
1087-
const auto* D = (const Decl*)method;
1089+
const auto* D = static_cast<const Decl*>(method);
10881090
if (auto *CXXMD = llvm::dyn_cast_or_null<CXXMethodDecl>(D)) {
10891091
return CXXMD->isStatic();
10901092
}
@@ -1456,10 +1458,6 @@ namespace Cpp {
14561458
}
14571459
}
14581460

1459-
QualType GetBuiltinType(const std::string& name, Sema& sema) {
1460-
return findBuiltinType(name, sema.getASTContext());
1461-
}
1462-
14631461
TCppType_t GetType(const std::string &name) {
14641462
QualType builtin = findBuiltinType(name, getASTContext());
14651463
if (!builtin.isNull())
@@ -2583,7 +2581,7 @@ namespace Cpp {
25832581

25842582
CPPINTEROP_API JitCall MakeFunctionCallable(TInterp_t I,
25852583
TCppConstFunction_t func) {
2586-
auto* D = (const clang::Decl*)func;
2584+
const auto* D = static_cast<const clang::Decl*>(func);
25872585
if (!D)
25882586
return {};
25892587

0 commit comments

Comments
 (0)