diff options
| author | Aotrix <[email protected]> | 2026-10-07 22:49:15 +0200 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-10-07 22:49:15 +0200 |
| commit | 0d684f65b364baf8551acafccf7169a7af24ad93 (patch) | |
| tree | 46cda812567eec1e9601443438e4b6a6af9a157a | |
| parent | be2826ed7596c7f82347af4f3908e8dce7558a6d (diff) | |
Add value parameter to function
| -rw-r--r-- | compile_commands.json | 4 | ||||
| -rw-r--r-- | main.cc | 9 | ||||
| -rw-r--r-- | 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 @@ -1,6 +1,7 @@ #include <iostream> -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<Expr>, 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<Expr>, InnerMatcher) { - if (Node.getNumArgs() < 2) + if (Node.getNumArgs() > 2) return false; const Expr* Arg = Node.getArg(1); if (Finder->isTraversalIgnoringImplicitNodes() && isa<CXXDefaultArgExpr>(Arg)) |
