Skip to content

Commit 73fe9fc

Browse files
changes according to code review
1 parent 480b7fa commit 73fe9fc

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

include/clang/Interpreter/CppInterOp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,10 @@ namespace Cpp {
547547
CPPINTEROP_API TCppType_t GetCanonicalType(TCppType_t type);
548548

549549
/// Get non restrict qualified version of the given type
550-
CPPINTEROP_API TCppType_t GetNonRestrictQualifiedType(TCppType_t type);
550+
CPPINTEROP_API TCppType_t GetNonRestrictType(TCppType_t type);
551551

552552
/// check if the type is restrict qualified i.e. __restrict
553-
CPPINTEROP_API bool IsRestrictQualifiedType(TCppType_t type);
553+
CPPINTEROP_API bool IsRestrictType(TCppType_t type);
554554

555555
/// Used to either get the built-in type of the provided string, or
556556
/// use the name to lookup the actual type.

lib/Interpreter/CppInterOp.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,23 +1657,19 @@ namespace Cpp {
16571657
return QT.getCanonicalType().getAsOpaquePtr();
16581658
}
16591659

1660-
bool IsRestrictQualifiedType(TCppType_t type) {
1661-
if (!type)
1662-
return 0;
1660+
bool IsRestrictType(TCppType_t type) {
16631661
QualType QT = QualType::getFromOpaquePtr(type);
16641662
return QT.isRestrictQualified();
16651663
}
16661664

1667-
TCppType_t GetNonRestrictQualifiedType(TCppType_t type) {
1668-
if (!type)
1669-
return 0;
1665+
TCppType_t GetNonRestrictType(TCppType_t type) {
16701666
QualType QT = QualType::getFromOpaquePtr(type);
16711667
if (QT.isRestrictQualified()) {
16721668
QualType NonRestrictType(QT);
16731669
NonRestrictType.removeLocalRestrict();
16741670
return NonRestrictType.getAsOpaquePtr();
16751671
}
1676-
return nullptr;
1672+
return type;
16771673
}
16781674

16791675
// Internal functions that are not needed outside the library are

unittests/CppInterOp/TypeReflectionTest.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,11 @@ TEST(TypeReflectionTest, RestrictQualifiedType) {
621621
Cpp::TCppType_t x = Cpp::GetVariableType(Cpp::GetNamed("x"));
622622
Cpp::TCppType_t y = Cpp::GetVariableType(Cpp::GetNamed("y"));
623623

624-
EXPECT_FALSE(Cpp::IsRestrictQualifiedType(x));
625-
EXPECT_TRUE(Cpp::IsRestrictQualifiedType(y));
624+
EXPECT_FALSE(Cpp::IsRestrictType(x));
625+
EXPECT_TRUE(Cpp::IsRestrictType(y));
626626

627-
EXPECT_FALSE(Cpp::GetNonRestrictQualifiedType(x));
628-
EXPECT_EQ(Cpp::GetCanonicalType(Cpp::GetNonRestrictQualifiedType(y)),
627+
EXPECT_EQ(Cpp::GetCanonicalType(Cpp::GetNonRestrictType(y)),
628+
Cpp::GetCanonicalType(x));
629+
EXPECT_EQ(Cpp::GetCanonicalType(Cpp::GetNonRestrictType(x)),
629630
Cpp::GetCanonicalType(x));
630631
}

0 commit comments

Comments
 (0)