Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.7.3
-
None
Description
Clang 19 changed its AST API. The following places don't compile anymore.
clangcodeparser.cpp
static std::string get_default_value_initializer_as_string(const clang::TemplateTypeParmDecl* parameter) { return (parameter && parameter->hasDefaultArgument()) ? get_fully_qualified_type_name(parameter->getDefaultArgument(), parameter->getASTContext()) : ""; }
There, getDefaultArgument doesn't return QualType anymore. The fragment has to be changed to
static std::string get_default_value_initializer_as_string(const clang::TemplateTypeParmDecl* parameter) { return (parameter && parameter->hasDefaultArgument()) ? get_fully_qualified_type_name(parameter->getDefaultArgument().getArgument().getAsType(), parameter->getASTContext()) : ""; }
Next fragment:
static std::string get_default_value_initializer_as_string(const clang::NonTypeTemplateParmDecl* parameter) { return (parameter && parameter->hasDefaultArgument()) ? get_expression_as_string(parameter->getDefaultArgument(), parameter->getASTContext()) : ""; }
My understanding is that it has to be changed to:
static std::string get_default_value_initializer_as_string(const clang::NonTypeTemplateParmDecl* parameter) { return (parameter && parameter->hasDefaultArgument()) ? get_expression_as_string(parameter->getDefaultArgument().getArgument().getAsExpr(), parameter->getASTContext()) : ""; }
Next fragment:
static std::string get_default_value_initializer_as_string(const clang::TemplateTemplateParmDecl* parameter) { std::string default_value{}; if (parameter && parameter->hasDefaultArgument()) { const clang::TemplateName template_name = parameter->getDefaultArgument().getArgument().getAsTemplate(); llvm::raw_string_ostream ss{default_value}; template_name.print(ss, parameter->getASTContext().getPrintingPolicy(), clang::TemplateName::Qualified::Fully); } return default_value; }
clang::TemplateName::Qualified enumeration doesn't have Fully anymore. I am not sure about a fix.
clangtoolastreader.cpp
Here
bool LupdateVisitor::VisitNamedDecl(clang::NamedDecl *namedDeclaration) { if (!m_macro) return true; auto fullLocation = m_context->getFullLoc(namedDeclaration->getBeginLoc()); if (!fullLocation.isValid() || !fullLocation.getFileEntry()) return true; if (!LupdatePrivate::isFileSignificant(fullLocation.getFileEntry()->getName().str())) return true; qCDebug(lcClang) << "NamedDecl Name: " << QString::fromStdString(namedDeclaration->getQualifiedNameAsString()); qCDebug(lcClang) << "NamedDecl source: " << QString::fromStdString(namedDeclaration->getSourceRange().printToString( m_context->getSourceManager())); // Checks if there is a macro located within the range of this NamedDeclaration // in order to find a context for the macro findContextForTranslationStoresFromPP(namedDeclaration); return true; }
FileEntry doesn't have getName anymore. I am not sure about a fix,
Attachments
Issue Links
- duplicates
-
QTBUG-129146 qttools fails yocto build with llvm 19
- Reported
-
QTBUG-128644 QDoc fails to compile against Clang-19 RC1-RC4, Clang 20
- Closed