Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang_delta/CommonRenameClassRewriteVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ template<typename T> bool CommonRenameClassRewriteVisitor<T>::
dyn_cast<DependentTemplateSpecializationType>(Ty);
TransAssert(DTST && "Bad DependentTemplateSpecializationType!");

#if LLVM_VERSION_MAJOR >= 21
const IdentifierInfo *IdInfo = DTST->getDependentTemplateName().getName().getIdentifier();
#else
const IdentifierInfo *IdInfo = DTST->getIdentifier();
#endif
std::string IdName = IdInfo->getName().str();
std::string Name;
if (getNewNameByName(IdName, Name)) {
Expand Down
10 changes: 8 additions & 2 deletions clang_delta/RemoveNamespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ bool RemoveNamespaceRewriteVisitor::VisitDependentTemplateSpecializationTypeLoc(
dyn_cast<DependentTemplateSpecializationType>(Ty);
TransAssert(DTST && "Bad DependentTemplateSpecializationType!");

#if LLVM_VERSION_MAJOR >= 21
const IdentifierInfo *IdInfo = DTST->getDependentTemplateName().getName().getIdentifier();
#else
const IdentifierInfo *IdInfo = DTST->getIdentifier();
#endif
std::string IdName = IdInfo->getName().str();
std::string Name;

Expand Down Expand Up @@ -562,8 +566,10 @@ bool RemoveNamespaceRewriteVisitor::TraverseNestedNameSpecifierLoc(
ND = NAD->getNamespace()->getCanonicalDecl();
break;
}
case NestedNameSpecifier::TypeSpec: // Fall-through
case NestedNameSpecifier::TypeSpecWithTemplate:
#if LLVM_VERSION_MAJOR < 21
case NestedNameSpecifier::TypeSpecWithTemplate: // Fall-through
#endif
case NestedNameSpecifier::TypeSpec:
TraverseTypeLoc(Loc.getTypeLoc());
break;
default:
Expand Down
4 changes: 4 additions & 0 deletions clang_delta/RemoveUnusedFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ bool RUFAnalysisVisitor::VisitFunctionDecl(FunctionDecl *FD)

if (FD->isReferenced() ||
FD->isMain() ||
#if LLVM_VERSION_MAJOR >= 21
FD->hasAttr<DeviceKernelAttr>() ||
#else
FD->hasAttr<OpenCLKernelAttr>() ||
#endif
ConsumerInstance->hasReferencedSpecialization(CanonicalFD) ||
ConsumerInstance->isInlinedSystemFunction(CanonicalFD) ||
ConsumerInstance->isInReferencedSet(CanonicalFD) ||
Expand Down
4 changes: 4 additions & 0 deletions clang_delta/RenameFun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ void RenameFun::addFun(const FunctionDecl *FD)
{
std::string Name = FD->getNameAsString();
// Skip special functions
#if LLVM_VERSION_MAJOR >= 21
if (isSpecialFun(Name) || FD->hasAttr<DeviceKernelAttr>())
#else
if (isSpecialFun(Name) || FD->hasAttr<OpenCLKernelAttr>())
#endif
FunToNameMap[FD] = Name;

if (FunToNameMap.find(FD) != FunToNameMap.end())
Expand Down
6 changes: 4 additions & 2 deletions clang_delta/Transformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,10 @@ const DeclContext *Transformation::getDeclContextFromSpecifier(
const NamespaceAliasDecl *NAD = NNS->getAsNamespaceAlias();
return NAD->getNamespace()->getCanonicalDecl();
}
case NestedNameSpecifier::TypeSpec: // Fall-through
case NestedNameSpecifier::TypeSpecWithTemplate: {
#if LLVM_VERSION_MAJOR < 21
case NestedNameSpecifier::TypeSpecWithTemplate: // Fall-through
#endif
case NestedNameSpecifier::TypeSpec: {
const Type *Ty = NNS->getAsType();
if (const RecordType *RT = Ty->getAs<RecordType>())
return RT->getDecl();
Expand Down
7 changes: 6 additions & 1 deletion clang_delta/TransformationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool TransformationManager::initializeCompilerInstance(std::string &ErrorMsg)
ClangInstance->createFileManager();

if(CLCPath != NULL && ClangInstance->hasFileManager() &&
ClangInstance->getFileManager().getDirectory(CLCPath, false)) {
ClangInstance->getFileManager().getOptionalDirectoryRef(CLCPath, false)) {
Args.push_back("-I");
Args.push_back(CLCPath);
}
Expand All @@ -146,8 +146,13 @@ bool TransformationManager::initializeCompilerInstance(std::string &ErrorMsg)
}

TargetInfo *Target =
#if LLVM_VERSION_MAJOR >= 21
TargetInfo::CreateTargetInfo(ClangInstance->getDiagnostics(),
ClangInstance->getInvocation().getTargetOpts());
#else
TargetInfo::CreateTargetInfo(ClangInstance->getDiagnostics(),
ClangInstance->getInvocation().TargetOpts);
#endif
ClangInstance->setTarget(Target);

if (const char *env = getenv("CREDUCE_INCLUDE_PATH")) {
Expand Down