aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2020-03-06 23:13:00 +0000
committerbloodstalker <thabogre@gmail.com>2020-03-06 23:13:00 +0000
commitf38997774cb41fba555347d5d47a08976362c41b (patch)
treeab20080e06d4db784a6dc78f330784be5dc264fd
parentupdated the man and readme. (diff)
downloadcgrep-f38997774cb41fba555347d5d47a08976362c41b.tar.gz
cgrep-f38997774cb41fba555347d5d47a08976362c41b.zip
coverage
Diffstat (limited to '')
-rw-r--r--cgrep.cpp6
-rwxr-xr-xcovrun.sh12
-rw-r--r--makefile12
3 files changed, 22 insertions, 8 deletions
diff --git a/cgrep.cpp b/cgrep.cpp
index c654617..d2039e8 100644
--- a/cgrep.cpp
+++ b/cgrep.cpp
@@ -601,8 +601,9 @@ public:
if (!Devi::IsTheMatchInMainFile(CO_MAINFILE, MR, SL))
return void();
const NamedDecl *ND = CE->getDirectCallee();
- if (ND)
+ if (ND == nullptr) {
return void();
+ }
std::string name = ND->getNameAsString();
if (regex_handler(REGEX_PP(CO_REGEX), name)) {
ast_type_traits::DynTypedNode DTN =
@@ -633,8 +634,9 @@ public:
if (!Devi::IsTheMatchInMainFile(CO_MAINFILE, MR, SL))
return void();
const NamedDecl *ND = CE->getDirectCallee();
- if (ND)
+ if (ND == nullptr) {
return void();
+ }
std::string name = ND->getNameAsString();
if (regex_handler(REGEX_PP(CO_REGEX), name)) {
ast_type_traits::DynTypedNode DNode =
diff --git a/covrun.sh b/covrun.sh
new file mode 100755
index 0000000..46f8fcf
--- /dev/null
+++ b/covrun.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/sh
+
+LLVM_PROFILE_FILE="one.profraw" "./cgrep-cov" -A 1 -B 1 --func --var --regex n[aA]m ./cgrep.cpp
+LLVM_PROFILE_FILE="one.profraw" "./cgrep-cov" -A 1 -B 1 --func --var --awk --regex n[aA]m ./cgrep.cpp
+LLVM_PROFILE_FILE="two.profraw" "./cgrep-cov" -A 1 -B 1 --func --declrefexpr --regex n[aA]m --nocolor --nodecl ./cgrep.cpp
+LLVM_PROFILE_FILE="three.profraw" "./cgrep-cov" -A 1 -B 1 --func --declrefexpr --memfunc --call --cxxcall --var --regex run ./cgrep.cpp
+LLVM_PROFILE_FILE="four.profraw" "./cgrep-cov" -A 1 -B 1 --macro --header --regex n[aA]m ./cgrep.cpp
+LLVM_PROFILE_FILE="five.profraw" "./cgrep-cov" -A 1 -B 1 --class --regex and ./cgrep.cpp
+LLVM_PROFILE_FILE="six.profraw" "./cgrep-cov" -A 1 -B 1 --struct --union --regex n[aA]m ./cgrep.cpp
+LLVM_PROFILE_FILE="seven.profraw" "./cgrep-cov" -A 1 -B 1 --nameddecl --regex n[aA]m ./cgrep.cpp
+LLVM_PROFILE_FILE="eight.profraw" "./cgrep-cov" -A 1 -B 1 --cxxcall --call --regex add ./cgrep.cpp
+LLVM_PROFILE_FILE="nine.profraw" "./cgrep-cov" -A 1 -B 1 --memvar --regex ite ./cgrep.cpp
diff --git a/makefile b/makefile
index 95243a1..0edf949 100644
--- a/makefile
+++ b/makefile
@@ -104,7 +104,7 @@ depend:.depend
%.odbg:%.cpp
$(CXX) $(CXX_FLAGS) -g -c $< -o $@
-%.ocov:%.cpp
+%.ocov:%.cpp pch.hpp.gch
$(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
pch.hpp.gch: pch.hpp
@@ -132,12 +132,12 @@ $(TARGET)-cov: $(TARGET).ocov ./cfe-extra/cfe_extra.ocov
$(CXX) $^ $(LD_FLAGS) $(COV_LD) -o $@
cov: runcov
- @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
- @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata -ignore-filename-regex=llvm clang
+ @llvm-profdata merge -sparse ./one.profraw ./two.profraw ./three.profraw ./four.profraw ./five.profraw ./six.profraw ./seven.profraw ./eight.profraw ./nine.profraw -o ./cgrep.profdata
+ @llvm-cov show $(TARGET)-cov -instr-profile=cgrep.profdata -ignore-filename-regex=llvm clang
covrep: runcov
- @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata
- @llvm-cov report $(TARGET)-cov -instr-profile=default.profdata -ignore-filename-regex=llvm -ignore-filename-regex=clang -show-functions autosarpp.cpp
+ @llvm-profdata merge -sparse ./one.profraw ./two.profraw ./three.profraw ./four.profraw ./five.profraw ./six.profraw ./seven.profraw ./eight.profraw ./nine.profraw -o ./cgrep.profdata
+ @llvm-cov report $(TARGET)-cov -instr-profile=cgrep.profdata -ignore-filename-regex=llvm -ignore-filename-regex=clang -show-functions cgrep.cpp
ASM:$(ASM_LIST)
@@ -162,7 +162,7 @@ $(TARGET).a: $(TARGET).o ./cfe-extra/cfe_extra.o
ar rcs $(TARGET).a $(TARGET).o
runcov: $(TARGET)-cov
- $(TARGET)-cov ./cgrep.cpp --
+ - ./covrun.sh
test: $(TARGET)
$(TARGET) --A 1 --B 1 --regex write --memvar ./cgrep.cpp