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
3 changes: 3 additions & 0 deletions include/CppInterOp/CppInterOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ CPPINTEROP_API bool IsNamespace(TCppScope_t scope);
/// Checks if the scope is a class or not.
CPPINTEROP_API bool IsClass(TCppScope_t scope);

/// Checks if the scope is a CUDA function or not.
CPPINTEROP_API bool IsCUDAFunction(TCppScope_t scope);

/// Checks if the scope is a function.
CPPINTEROP_API bool IsFunction(TCppScope_t scope);

Expand Down
11 changes: 11 additions & 0 deletions lib/CppInterOp/CppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,17 @@
return isa<NamespaceDecl>(D);
}

bool IsCUDAFunction(TCppScope_t scope) {
Decl* D = static_cast<Decl*>(scope);
if (auto* FD = llvm::dyn_cast<FunctionDecl>(D)) {
for (const auto& i : FD->attrs()) {
if (i->getKind() == clang::attr::Kind::CUDAGlobal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "clang::attr::Kind" is directly included [misc-include-cleaner]

lib/CppInterOp/CppInterOp.cpp:41:

- #if CLANG_VERSION_MAJOR >= 19
+ #include <clang/Basic/AttrKinds.h>
+ #if CLANG_VERSION_MAJOR >= 19

return true;

Check warning on line 312 in lib/CppInterOp/CppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/CppInterOp/CppInterOp.cpp#L307-L312

Added lines #L307 - L312 were not covered by tests
}
}
return false;

Check warning on line 315 in lib/CppInterOp/CppInterOp.cpp

View check run for this annotation

Codecov / codecov/patch

lib/CppInterOp/CppInterOp.cpp#L315

Added line #L315 was not covered by tests
}

bool IsClass(TCppScope_t scope) {
Decl* D = static_cast<Decl*>(scope);
return isa<CXXRecordDecl>(D);
Expand Down
Loading