Skip to content

Commit ee80d34

Browse files
committed
Avoid getThisObjectType() which is removed in Clang 18
As part of implementing "deducing this" the getThisObjectType() method on CXXMethodDecl was renamed and split in two. To support building subdoc against LLVM 16, 17 and 18, switch to using getThisType()->getPointeeType() instead.
1 parent 608e4a2 commit ee80d34

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

subdoc/lib/visit.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class Visitor : public clang::RecursiveASTVisitor<Visitor> {
487487
return true;
488488
}
489489

490-
bool VisitUsingEnumDecl(clang::UsingEnumDecl* decl) noexcept {
490+
bool FthiEnumDecl(clang::UsingEnumDecl* decl) noexcept {
491491
clang::RawComment* raw_comment = get_raw_comment(decl);
492492
if (raw_comment) {
493493
// `using enum` actually brings in each element of the enum, so a comment
@@ -950,7 +950,10 @@ class Visitor : public clang::RecursiveASTVisitor<Visitor> {
950950

951951
std::string function_name = [&] {
952952
if (auto* mdecl = clang::dyn_cast<clang::CXXConstructorDecl>(decl)) {
953-
return mdecl->getThisObjectType()->getAsRecordDecl()->getNameAsString();
953+
return mdecl->getThisType()
954+
->getPointeeType()
955+
->getAsRecordDecl()
956+
->getNameAsString();
954957
} else if (auto* convdecl =
955958
clang::dyn_cast<clang::CXXConversionDecl>(decl)) {
956959
Type t = build_local_type(convdecl->getReturnType(),

0 commit comments

Comments
 (0)