Skip to content

Commit

Permalink
Fix updates to clang 13 API
Browse files Browse the repository at this point in the history
  • Loading branch information
plowsec committed Mar 9, 2022
1 parent f34e447 commit b30f78b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions MatchHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void MatchHandler::handleCallExpr(const clang::StringLiteral *pLiteral, clang::A
StringType = "TCHAR ";
}

for(auto i = 0 ; i < FunctionCall->getDirectCallee()->getNumParams() ; i++) {
for(unsigned int i = 0 ; i < FunctionCall->getDirectCallee()->getNumParams() ; i++) {

auto ArgStart = pContext->getSourceManager().getSpellingColumnNumber(FunctionCall->getArg(i)->getBeginLoc());
auto StringStart = pContext->getSourceManager().getSpellingColumnNumber(pLiteral->getBeginLoc());
Expand Down Expand Up @@ -234,7 +234,7 @@ void MatchHandler::handleVarDeclExpr(const clang::StringLiteral *pLiteral, clang
if(Type.find(" []") != std::string::npos)
LHSReplacement = Type.replace(Type.find(" []"),3,"* ");

LHSReplacement.append(Identifier.data());
LHSReplacement.append(Identifier);

llvm::outs() << "Type of " << Identifier << " is " << Type << "\n";
std::string NewType = Type+" ";
Expand Down
9 changes: 5 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#include <vector>
#include <fstream>


namespace ClSetup {
llvm::cl::OptionCategory ToolCategory("AVObfuscator");
static llvm::cl::OptionCategory ToolCategory("AVObfuscator");

llvm::cl::opt<bool> IsEditEnabled("edit",
llvm::cl::desc("Edit the file in place, or write a copy with .patch extension."),
Expand Down Expand Up @@ -210,9 +211,9 @@ auto main(int argc, const char *argv[]) -> int {
using namespace clang::tooling;
using namespace ClSetup;

CommonOptionsParser OptionsParser(argc, argv, ToolCategory);
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
auto option_parser = CommonOptionsParser::create(argc, argv, ToolCategory);
ClangTool Tool(option_parser->getCompilations(),
option_parser->getSourcePathList());

auto Action = newFrontendActionFactory<AVObfuscator::Action>();
return Tool.run(Action.get());
Expand Down

0 comments on commit b30f78b

Please sign in to comment.