Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions analyzer/codechecker_analyzer/analysis_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import zipfile

from threading import Timer
from pathlib import Path

import multiprocess
import psutil
Expand Down Expand Up @@ -712,8 +713,10 @@ def skip_cpp(compile_actions, skip_handlers):
analyze = []
skip = []
for compile_action in compile_actions:

if skip_handlers and skip_handlers.should_skip(compile_action.source):
if skip_handlers and \
skip_handlers.should_skip(
str(Path(Path(compile_action.directory).resolve(),
compile_action.source))):
skip.append(compile_action)
else:
analyze.append(compile_action)
Expand Down
5 changes: 4 additions & 1 deletion analyzer/codechecker_analyzer/buildlog/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# pylint: disable=no-name-in-module
from distutils.spawn import find_executable
from enum import Enum
from pathlib import Path

import glob
import json
Expand Down Expand Up @@ -1290,7 +1291,9 @@ def parse_unique_log(compilation_database,
# Skipping of the compile commands is done differently if no
# CTU or statistics related feature was enabled.
if analysis_skip_handlers \
and analysis_skip_handlers.should_skip(entry['file']) \
and analysis_skip_handlers.should_skip(
str(Path(Path(entry["directory"]).resolve(),
entry["file"]))) \
and (not ctu_or_stats_enabled or pre_analysis_skip_handlers
and pre_analysis_skip_handlers.should_skip(
entry['file'])):
Expand Down
13 changes: 13 additions & 0 deletions analyzer/tests/functional/skip/test_files/multidir/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default: src/a.o src/b.o

src/b.o: src/b.cpp
$(CXX) -c src/b.cpp -o /dev/null

src/a.o: src/a.cpp lib/lib.o
$(CXX) -c src/a.cpp -o /dev/null

lib/lib.o: lib/lib.cpp
$(CXX) -c lib/lib.cpp -o /dev/null

clean:
rm -rf src/*.o lib/*.o
3 changes: 3 additions & 0 deletions analyzer/tests/functional/skip/test_files/multidir/b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int root(){
return 1/0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"directory": ".",
"command": "/usr/bin/g++ -c b.cpp -o /dev/null",
"file": "b.cpp"
}
,
{
"directory": ".",
"command": "/usr/bin/g++ -c lib/lib.cpp -o /dev/null",
"file": "lib/lib.cpp"
}
,
{
"directory": ".",
"command": "/usr/bin/g++ -c src/a.cpp -o /dev/null",
"file": "src/a.cpp"
}
,
{
"directory": ".",
"command": "/usr/bin/g++ -c src/b.cpp -o /dev/null",
"file": "src/b.cpp"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef LIB_H
#define LIB_H

int myDiv(int x);

#endif
10 changes: 10 additions & 0 deletions analyzer/tests/functional/skip/test_files/multidir/lib/lib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "../include/lib.h"
/*
* The error in this file should only be reported in
* CTU mode, through a.cpp.
*/

int myDiv(int x)
{
return 1 / x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "../include/lib.h"

void foo() {
int* p = new int(0);
delete p;
delete p;
myDiv(0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main() {
int i = 1 / 0;
}
Loading