Commit 56f1c5a8 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

fixing bug


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 33cc54ca
Pipeline #61774 passed with stages
in 10 minutes and 29 seconds
......@@ -84,7 +84,8 @@ def main(argv=None):
if not opts.keep_tmp_src:
os.remove('.'+opts.file.replace('.','_out.'))
os.remove('.'+opts.file.replace('.','_pragma_out.'))
os.remove('.'+opts.file.replace('.','_pragma_out.')) if os.path.exists('.'+opts.file.replace('.','_pragma_out.')) else None
return 0
......
......@@ -117,7 +117,7 @@ bool KernelVisitor::VisitFunctionDecl(FunctionDecl *F) {
", std::shared_ptr<xacc::Observable> obs)");
} else {
replacement += "function = function->operator()(params);\n";
if (F->getAttrs().size() > 1) replacement += "function = function->operator()(params);\n";
replacement += "acc->execute(" + bufferName + ",function);\n";
}
replacement += "}\n";
......
......@@ -28,6 +28,7 @@ protected:
// PragmaAttributeInfo(ParsedAttributes &Attributes) :
// Attributes(Attributes) {}
};
public:
std::string observable = "";
......
......@@ -97,6 +97,7 @@ protected:
CI.getDiagnosticClient().EndSourceFile();
if (!ph->functionName.empty()) {
rewriter.ReplaceText(map[ph->functionName].getLocWithOffset(2), 1,
") __observe__(\"" + ph->observable + "\")");
......@@ -122,6 +123,7 @@ protected:
}
outFile.close();
}
}
};
......@@ -217,6 +219,10 @@ int main(int argc, char **argv) {
std::ifstream t2(outName);
std::string src2((std::istreambuf_iterator<char>(t2)),
std::istreambuf_iterator<char>());
if (src2.empty()) {
src2 = src;
}
auto action2 = new XACCFrontendAction(Rewrite2, fileName);
if (!tooling::runToolOnCodeWithArgs(action2, src2, args)) {
xacc::error("Error running xacc compiler.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment