From 0d684f65b364baf8551acafccf7169a7af24ad93 Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Wed, 7 Oct 2026 22:49:15 +0200 Subject: Add value parameter to function --- compile_commands.json | 4 ++-- main.cc | 9 +++++---- removeFunctionCall.cpp | 4 +--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/compile_commands.json b/compile_commands.json index ff109c6..da7fc2f 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1,8 +1,8 @@ [ { "directory": "/home/aotrix/development/clang_AST/removeFunctionCall/build", - "command": "/usr/bin/c++ -std=gnu++20 -fno-exceptions -funwind-tables -o CMakeFiles/remove-function-call.dir/removeFunctionCall.cpp.o -c /home/aotrix/development/clang_AST/removeFunctionCall/removeFunctionCall.cpp -I/usr/lib/gcc/x86_64-pc-linux-gnu/16/include", + "command": "/usr/bin/c++ -std=gnu++20 -fno-exceptions -funwind-tables -o CMakeFiles/remove-function-call.dir/removeFunctionCall.cpp.o -c /home/aotrix/development/clang_AST/removeFunctionCall/removeFunctionCall.cpp", "file": "/home/aotrix/development/clang_AST/removeFunctionCall/removeFunctionCall.cpp", "output": "CMakeFiles/remove-function-call.dir/removeFunctionCall.cpp.o" } -] +] \ No newline at end of file diff --git a/main.cc b/main.cc index de75719..41a3200 100644 --- a/main.cc +++ b/main.cc @@ -1,6 +1,7 @@ #include -bool configValue(const std::string& iKey) +bool configValue(const std::string& iKey, + const std::string& iExpectedValue) { bool result; std::cin >> result; @@ -16,12 +17,12 @@ bool coucouEveryone() int main() { - std::string aValue{"aparam"}; - if (configValue(aValue)) + std::string aValue{"stari"}; + if (configValue(aValue, "on")) { coucouEveryone(); } - if (!configValue("")) + if (!configValue("burger", "on")) { std::cout << "Mouhahahaha I am a villain!\n"; } diff --git a/removeFunctionCall.cpp b/removeFunctionCall.cpp index 16bd6a9..8f62818 100644 --- a/removeFunctionCall.cpp +++ b/removeFunctionCall.cpp @@ -87,8 +87,6 @@ AST_POLYMORPHIC_MATCHER_P2(hasVariableNameArgument, clang::ast_matchers::internal::Matcher, InnerMatcher) { - if (!VariableName.empty()) - std::cout << VariableName << " ; " << Node.getNumArgs() << '\n'; if (!Node.getNumArgs()) return false; const Expr* Arg = Node.getArg(0); @@ -107,7 +105,7 @@ AST_POLYMORPHIC_MATCHER_P2(hasExpectedValueArgument, clang::ast_matchers::internal::Matcher, InnerMatcher) { - if (Node.getNumArgs() < 2) + if (Node.getNumArgs() > 2) return false; const Expr* Arg = Node.getArg(1); if (Finder->isTraversalIgnoringImplicitNodes() && isa(Arg)) -- cgit v1.2.3