Commit 01b75235 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

removing old qcor plugin action


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 448b4b53
#include "QCORPluginAction.hpp"
#include "QCORASTConsumer.hpp"
#include "XACC.hpp"
namespace qcor {
namespace compiler {
std::unique_ptr<ASTConsumer>
QCORPluginAction::CreateASTConsumer(CompilerInstance &ci, llvm::StringRef) {
return llvm::make_unique<QCORASTConsumer>(ci);
}
bool QCORPluginAction::ParseArgs(const CompilerInstance &ci,
const std::vector<std::string> &args) {
if (!xacc::isInitialized()) {
std::vector<std::string> local;
local.push_back("--logger-name");
local.push_back("qcor");
xacc::Initialize(local);
}
auto it = std::find(args.begin(), args.end(), "accelerator");
if (it != args.end()) {
int index = std::distance(args.begin(), it);
auto acc = args[index + 1];
xacc::setAccelerator(acc);
}
std::vector<std::string> transformations;
it = args.begin();
std::for_each(args.begin(), args.end(), [&](const std::string &value) {
if (value == "transform") {
int index = std::distance(args.begin(), it);
auto transformationName = args[index + 1];
transformations.push_back(transformationName);
}
++it;
});
if (!transformations.empty()) {
std::string transformNames = transformations[0];
for (int i = 1; i < transformations.size(); ++i) {
transformNames += "," + transformations[i];
}
xacc::setOption("qcor-transforms", transformNames);
}
return true;
}
// PluginASTAction::ActionType QCORPluginAction::getActionType() {
// return PluginASTAction::AddBeforeMainAction;
// }
} // namespace compiler
} // namespace qcor
static FrontendPluginRegistry::Add<qcor::compiler::QCORPluginAction>
X("enable-quantum", "Enable quantum language extension via XACC.");
\ No newline at end of file
#ifndef COMPILER_QCORPLUGINASTACTION_HPP_
#define COMPILER_QCORPLUGINASTACTION_HPP_
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/Sema/Sema.h"
using namespace clang;
namespace qcor {
namespace compiler {
class QCORPluginAction : public PluginASTAction {
protected:
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef) override;
bool ParseArgs(const CompilerInstance &CI,
const std::vector<std::string> &args) override;
// PluginASTAction::ActionType getActionType() override;
};
} // namespace compiler
} // namespace qcor
#endif
\ No newline at end of file
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "FuzzyParsingExternalSemaSource.hpp" #include "FuzzyParsingExternalSemaSource.hpp"
#include "LambdaVisitor.hpp" #include "LambdaVisitor.hpp"
#include "QCORASTConsumer.hpp" #include "QCORASTConsumer.hpp"
#include "QCORPluginAction.hpp"
#include "DigitalGates.hpp" #include "DigitalGates.hpp"
#include "CountGatesOfTypeVisitor.hpp" #include "CountGatesOfTypeVisitor.hpp"
......
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