aboutsummaryrefslogtreecommitdiffstats
path: root/mutator-lvl2.cpp
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-08-19 19:36:45 +0000
committerbloodstalker <thabogre@gmail.com>2018-08-19 19:36:45 +0000
commitc0959b173b1358ce8b4e3e02c3cd9166186b1f2e (patch)
tree24f1f8d455847cb184f43427129a2d04f0532ff4 /mutator-lvl2.cpp
parentmakefile updates for obfuscator and bruiser (diff)
downloadmutator-c0959b173b1358ce8b4e3e02c3cd9166186b1f2e.tar.gz
mutator-c0959b173b1358ce8b4e3e02c3cd9166186b1f2e.zip
fixes #47. probably a good idea to just wipe and re-clone. also moved m0 to its own folder.
Diffstat (limited to 'mutator-lvl2.cpp')
-rw-r--r--mutator-lvl2.cpp120
1 files changed, 0 insertions, 120 deletions
diff --git a/mutator-lvl2.cpp b/mutator-lvl2.cpp
deleted file mode 100644
index c585734..0000000
--- a/mutator-lvl2.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-
-/***************************************************Project Mutator****************************************************/
-//-*-c++-*-
-/*first line intentionally left blank.*/
-/*Copyright (C) 2017 Farzad Sadeghi
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 3
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/
-/*code structure inspired by Eli Bendersky's tutorial on Rewriters.*/
-/**********************************************************************************************************************/
-/*FIXME-all classes should use replacements.*/
-/**********************************************************************************************************************/
-/*included modules*/
-/*project headers*/
-//#include "mutator_aux.h"
-/*standard headers*/
-#include <string>
-#include <iostream>
-#include <cassert>
-/*LLVM headers*/
-#include "clang/AST/AST.h"
-#include "clang/AST/ASTConsumer.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/Basic/LLVM.h"
-#include "clang/CodeGen/CodeGenAction.h"
-#include "clang/CodeGen/BackendUtil.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Frontend/FrontendActions.h"
-#include "clang/Lex/Lexer.h"
-#include "clang/Tooling/CommonOptionsParser.h"
-#include "clang/Tooling/Tooling.h"
-#include "clang/Rewrite/Core/Rewriter.h"
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/BasicBlock.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/Function.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/Linker/Linker.h"
-/**********************************************************************************************************************/
-/*used namespaces*/
-using namespace llvm;
-using namespace clang;
-using namespace clang::ast_matchers;
-using namespace clang::driver;
-using namespace clang::tooling;
-/**********************************************************************************************************************/
-/*global vars*/
-static llvm::cl::OptionCategory MatcherSampleCategory("Matcher Sample");
-/**********************************************************************************************************************/
-class BlankDiagConsumer : public clang::DiagnosticConsumer
-{
- public:
- BlankDiagConsumer() = default;
- virtual ~BlankDiagConsumer() {}
- virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override {}
-};
-/**********************************************************************************************************************/
-class MyASTConsumer : public ASTConsumer {
-public:
- MyASTConsumer(Rewriter &R) {
- }
-
- void HandleTranslationUnit(ASTContext &Context) {
- std::cout << "i was here\n";
- //Matcher.matchAST(Context);
- }
-
-private:
- MatchFinder Matcher;
-};
-/**********************************************************************************************************************/
-class MyFrontendAction : public ASTFrontendAction {
-public:
- MyFrontendAction() {}
- void EndSourceFileAction() override {
- //TheRewriter.getEditBuffer(TheRewriter.getSourceMgr().getMainFileID()).write(llvm::outs());
- }
-
- std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef file) override {
- DiagnosticsEngine &DE = CI.getPreprocessor().getDiagnostics();
- DE.setClient(BDCProto, false);
- TheRewriter.setSourceMgr(CI.getSourceManager(), CI.getLangOpts());
- //return llvm::make_unique<ASTConsumer>(new MyASTConsumer(TheRewriter));
- //return llvm::make_unique<ASTConsumer>(*new MyASTConsumer(TheRewriter));
- return llvm::make_unique<MyASTConsumer>(TheRewriter);
- //return std::unique_ptr<ASTConsumer>(new ASTConsumer);
- }
-
-private:
- BlankDiagConsumer* BDCProto = new BlankDiagConsumer;
- Rewriter TheRewriter;
-};
-/**********************************************************************************************************************/
-/*Main*/
-int main(int argc, const char **argv) {
- CommonOptionsParser op(argc, argv, MatcherSampleCategory);
- ClangTool Tool(op.getCompilations(), op.getSourcePathList());
-
- int ret;
- ret = Tool.run(newFrontendActionFactory<MyFrontendAction>().get());
- std::cout << "fucking done!\n";
- return ret;
-}
-/*last line intentionally left blank.*/
-