From 2e75136197cc53fe73be1f7d2f3fe4a88f970318 Mon Sep 17 00:00:00 2001 From: atimofee Date: Mon, 29 Feb 2016 20:27:38 +0300 Subject: [PATCH] CUDA type names in sizeof() expression conversion added [ROCm/hip commit: 432500056a8b8af01910001d884569d4660bb950] --- projects/hip/src/Cuda2Hip.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/projects/hip/src/Cuda2Hip.cpp b/projects/hip/src/Cuda2Hip.cpp index bb02357869..c86a80bfb7 100644 --- a/projects/hip/src/Cuda2Hip.cpp +++ b/projects/hip/src/Cuda2Hip.cpp @@ -517,6 +517,20 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { begin = end + 1; } } + + if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) + { + TypeSourceInfo * typeInfo = expr->getArgumentTypeInfo(); + QualType QT = typeInfo->getType().getUnqualifiedType(); + const Type * type = QT.getTypePtr(); + StringRef name = type->getAsCXXRecordDecl()->getName(); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = typeInfo->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replace->insert(Rep); + } } private: