MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / VisitFunctionDecl

Method VisitFunctionDecl

cudaq/lib/Frontend/nvqpp/ASTBridge.cpp:249–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247 }
248
249 bool VisitFunctionDecl(clang::FunctionDecl *x) {
250 if (ignoreTemplate)
251 return true;
252 auto *func = x->getDefinition();
253
254 if (func) {
255 bool runChecks = false;
256 if (cudaq::ASTBridgeAction::ASTBridgeConsumer::isCustomOpGenerator(
257 func)) {
258 customOperationNames[func->getName().str()] =
259 cudaq::detail::getTagNameOfFunctionDecl(func, mangler);
260 runChecks = true;
261 }
262 if (cudaq::ASTBridgeAction::ASTBridgeConsumer::isQuantum(func))
263 runChecks = true;
264 else
265 quantumTypesNotAllowed = true;
266
267 if (runChecks) {
268 quantumTypesNotAllowed = false;
269 // Run semantics checks on the kernel class.
270 if (isa<clang::CXXMethodDecl>(func)) {
271 auto *cxxClass = cast<clang::CXXRecordDecl>(func->getParent());
272 check(cxxClass);
273 }
274 processQpu(cudaq::detail::getTagNameOfFunctionDecl(func, mangler),
275 func);
276 }
277 } else if (cudaq::ASTBridgeAction::ASTBridgeConsumer::isQuantum(x)) {
278 // Add declarations to support separate compilation.
279 processQpu</*replace=*/false>(
280 cudaq::detail::getTagNameOfFunctionDecl(x, mangler), x);
281 }
282 return true;
283 }
284
285 // NB: DataRecursionQueue* argument intentionally omitted.
286 bool TraverseLambdaExpr(clang::LambdaExpr *x) {

Callers

nothing calls this directly

Calls 4

getNameMethod · 0.80
getParentMethod · 0.80
checkFunction · 0.50
strMethod · 0.45

Tested by

no test coverage detected