Loading handlers/qcor_syntax_handler.cpp +23 −13 Original line number Diff line number Diff line Loading @@ -48,13 +48,23 @@ void QCORSyntaxHandler::GetReplacement(Preprocessor &PP, Declarator &D, } else if (type == "qcor::qreg") { bufferNames.push_back(ident->getName().str()); type = "qreg"; } else if (type.find("xacc::internal_compiler::qubit") != std::string::npos) { } else if (type.find("xacc::internal_compiler::qubit") != std::string::npos) { bufferNames.push_back(ident->getName().str()); type = "qubit"; } program_arg_types.push_back(type); program_parameters.push_back(var); // If this was a passed kernel as a KernelSignature, then // we need to add to the kernels in translation unit if (auto t = dyn_cast<TypedefType>(parm_var_decl->getType())) { auto d = t->desugar(); if (d.getAsString().find("KernelSignature") != std::string::npos) { qcor::append_kernel(var, {}, {}); } } } GetReplacement(PP, kernel_name, program_arg_types, program_parameters, Loading Loading @@ -88,17 +98,17 @@ void QCORSyntaxHandler::GetReplacement( // with XACC api calls qcor::append_kernel(kernel_name, program_arg_types, program_parameters); for (int i = 0; i < program_arg_types.size(); i++) { if (program_arg_types[i].find("CallableKernel") != std::string::npos) { // we have a kernel we can call, need to add it to // append_kernel call. qcor::append_kernel(program_parameters[i], {}, {}); } } // for (int i = 0; i < program_arg_types.size(); i++) { // if (program_arg_types[i].find("CallableKernel") != std::string::npos) { // // we have a kernel we can call, need to add it to // // append_kernel call. // qcor::append_kernel(program_parameters[i], {}, {}); // } // } std::string src_to_prepend; auto new_src = qcor::run_token_collector(PP, Toks, src_to_prepend, kernel_name, program_arg_types, auto new_src = qcor::run_token_collector(PP, Toks, src_to_prepend, kernel_name, program_arg_types, program_parameters, bufferNames); if (!src_to_prepend.empty()) OS << src_to_prepend; Loading Loading
handlers/qcor_syntax_handler.cpp +23 −13 Original line number Diff line number Diff line Loading @@ -48,13 +48,23 @@ void QCORSyntaxHandler::GetReplacement(Preprocessor &PP, Declarator &D, } else if (type == "qcor::qreg") { bufferNames.push_back(ident->getName().str()); type = "qreg"; } else if (type.find("xacc::internal_compiler::qubit") != std::string::npos) { } else if (type.find("xacc::internal_compiler::qubit") != std::string::npos) { bufferNames.push_back(ident->getName().str()); type = "qubit"; } program_arg_types.push_back(type); program_parameters.push_back(var); // If this was a passed kernel as a KernelSignature, then // we need to add to the kernels in translation unit if (auto t = dyn_cast<TypedefType>(parm_var_decl->getType())) { auto d = t->desugar(); if (d.getAsString().find("KernelSignature") != std::string::npos) { qcor::append_kernel(var, {}, {}); } } } GetReplacement(PP, kernel_name, program_arg_types, program_parameters, Loading Loading @@ -88,17 +98,17 @@ void QCORSyntaxHandler::GetReplacement( // with XACC api calls qcor::append_kernel(kernel_name, program_arg_types, program_parameters); for (int i = 0; i < program_arg_types.size(); i++) { if (program_arg_types[i].find("CallableKernel") != std::string::npos) { // we have a kernel we can call, need to add it to // append_kernel call. qcor::append_kernel(program_parameters[i], {}, {}); } } // for (int i = 0; i < program_arg_types.size(); i++) { // if (program_arg_types[i].find("CallableKernel") != std::string::npos) { // // we have a kernel we can call, need to add it to // // append_kernel call. // qcor::append_kernel(program_parameters[i], {}, {}); // } // } std::string src_to_prepend; auto new_src = qcor::run_token_collector(PP, Toks, src_to_prepend, kernel_name, program_arg_types, auto new_src = qcor::run_token_collector(PP, Toks, src_to_prepend, kernel_name, program_arg_types, program_parameters, bufferNames); if (!src_to_prepend.empty()) OS << src_to_prepend; Loading