summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compile_commands.json4
-rw-r--r--main.cc9
-rw-r--r--removeFunctionCall.cpp4
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 <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))