Skip to content

Commit

Permalink
Avoid getThisObjectType() which is removed in Clang 18
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danakj committed Oct 7, 2023
1 parent bd88e79 commit 838eb73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions subdoc/lib/visit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ class Visitor : public clang::RecursiveASTVisitor<Visitor> {
return true;
}

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

std::string function_name = [&] {
if (auto* mdecl = clang::dyn_cast<clang::CXXConstructorDecl>(decl)) {
return mdecl->getThisObjectType()->getAsRecordDecl()->getNameAsString();
return mdecl->getThisType()
->getPointeeType()
->getAsRecordDecl()
->getNameAsString();
} else if (auto* convdecl =
clang::dyn_cast<clang::CXXConversionDecl>(decl)) {
Type t = build_local_type(convdecl->getReturnType(),
Expand Down

0 comments on commit 838eb73

Please sign in to comment.