Commit b52c27aa authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Updating api to fix clang warnings



Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 18f3fa60
...@@ -161,15 +161,16 @@ std::shared_ptr<Accelerator> getAccelerator() { ...@@ -161,15 +161,16 @@ std::shared_ptr<Accelerator> getAccelerator() {
error("Invalid use of XACC API. getAccelerator() with no string argument " error("Invalid use of XACC API. getAccelerator() with no string argument "
"requires that you set --accelerator at the command line."); "requires that you set --accelerator at the command line.");
} }
auto acc = ServiceRegistry::instance()->getService<Accelerator>(getOption("accelerator")); auto acc = ServiceRegistry::instance()->getService<Accelerator>(getOption("accelerator"));
if (acc) { if (acc) {
acc->initialize(); acc->initialize();
return acc;
} else { } else {
error( error(
"Invalid Accelerator. Could not find " + getOption("accelerator") "Invalid Accelerator. Could not find " + getOption("accelerator")
+ " in Accelerator Registry."); + " in Accelerator Registry.");
} }
return acc;
} }
std::shared_ptr<Accelerator> getAccelerator(const std::string& name) { std::shared_ptr<Accelerator> getAccelerator(const std::string& name) {
...@@ -181,12 +182,12 @@ std::shared_ptr<Accelerator> getAccelerator(const std::string& name) { ...@@ -181,12 +182,12 @@ std::shared_ptr<Accelerator> getAccelerator(const std::string& name) {
auto acc = ServiceRegistry::instance()->getService<Accelerator>(name); auto acc = ServiceRegistry::instance()->getService<Accelerator>(name);
if (acc) { if (acc) {
acc->initialize(); acc->initialize();
return acc;
} else { } else {
error( error(
"Invalid Accelerator. Could not find " + name "Invalid Accelerator. Could not find " + name
+ " in Accelerator Registry."); + " in Accelerator Registry.");
} }
return acc;
} }
bool hasAccelerator(const std::string& name) { bool hasAccelerator(const std::string& name) {
...@@ -206,13 +207,12 @@ std::shared_ptr<Compiler> getCompiler(const std::string& name) { ...@@ -206,13 +207,12 @@ std::shared_ptr<Compiler> getCompiler(const std::string& name) {
"xacc::Initialize() before using API."); "xacc::Initialize() before using API.");
} }
auto c = ServiceRegistry::instance()->getService<Compiler>(name); auto c = ServiceRegistry::instance()->getService<Compiler>(name);
if (c) { if (!c) {
return c;
} else {
error( error(
"Invalid Compiler. Could not find " + name "Invalid Compiler. Could not find " + name
+ " in Service Registry."); + " in Service Registry.");
} }
return c;
} }
std::shared_ptr<Compiler> getCompiler() { std::shared_ptr<Compiler> getCompiler() {
...@@ -227,13 +227,12 @@ std::shared_ptr<Compiler> getCompiler() { ...@@ -227,13 +227,12 @@ std::shared_ptr<Compiler> getCompiler() {
"requires that you set --compiler at the command line."); "requires that you set --compiler at the command line.");
} }
auto compiler = ServiceRegistry::instance()->getService<Compiler>(getOption("compiler")); auto compiler = ServiceRegistry::instance()->getService<Compiler>(getOption("compiler"));
if (compiler) { if (!compiler) {
return compiler;
} else {
error( error(
"Invalid Compiler. Could not find " + (*options)["compiler"] "Invalid Compiler. Could not find " + (*options)["compiler"]
+ " in Compiler Registry."); + " in Compiler Registry.");
} }
return compiler;
} }
bool hasCompiler(const std::string& name) { bool hasCompiler(const std::string& name) {
...@@ -248,14 +247,13 @@ std::shared_ptr<IRTransformation> getIRTransformations( ...@@ -248,14 +247,13 @@ std::shared_ptr<IRTransformation> getIRTransformations(
"xacc::Initialize() before using API."); "xacc::Initialize() before using API.");
} }
auto t = ServiceRegistry::instance()->getService<IRTransformation>(name); auto t = ServiceRegistry::instance()->getService<IRTransformation>(name);
if (t) { if (!t) {
return t;
} else {
error( error(
"Invalid IRTransformation. Could not find " + name "Invalid IRTransformation. Could not find " + name
+ " in Service Registry."); + " in Service Registry.");
} }
return t;
} }
const std::string translate(const std::string& original, const std::string& originalLanguageName, const std::string translate(const std::string& original, const std::string& originalLanguageName,
......
Supports Markdown
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