Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/cpp-ci-serial-programs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,20 @@ jobs:
hasDeclaration(cxxConstructorDecl(ofClass(hasName("std::filesystem::path")))),
hasArgument(0, hasType(asString("std::string")))
)
match cxxConstructExpr(
isExpansionInFileMatching("SerialPrograms/"),
hasDeclaration(cxxConstructorDecl(ofClass(hasName("ImageViewRGB32")))),
hasArgument(0, hasType(rValueReferenceType(pointee(hasType(hasName("VideoSnapshot")))))),
unless(hasAncestor(functionDecl(isInline())))
)
EOF

files=$(jq -r '.[].file' SerialPrograms/bin/compile_commands.json)
echo "$files" | xargs --max-args=150 clang-query -p SerialPrograms/bin/ -f query.txt >> output.txt
echo "$files" | xargs --max-procs=0 --max-args=1 clang-query -p SerialPrograms/bin/ -f query.txt >> output.txt
cat output.txt
if grep --silent "Match #" output.txt; then
echo "::error Forbidden std::filesystem::path construction detected!"
if grep "Match #" output.txt; then
echo "::error Forbidden code detected. It can be"
echo "::error - a std::filesystem::path created from std::string. More information https://discord.com/channels/695809740428673034/1462210406616531259/1462567541825339635"
echo "::error - a ImageViewRGB32 created from VideoSnapshot&& that is stored. It is a dangling pointer as nothing hold the data anymore"
exit 1
fi
Loading