fix PrintAST test run

The refactored shouldDumpFunction was now rejecting functions without a
location. This is fixed now.
This commit is contained in:
Paolo Tranquilli
2021-11-22 14:11:52 +00:00
committed by GitHub
parent 0547e4ccf2
commit 0bb11fa371
2 changed files with 5 additions and 7 deletions

View File

@@ -1,12 +1,10 @@
private import cpp
/**
* Holds if an AST or IR with the specified location should be printed in the test output.
*
* This predicate excludes locations in standard headers.
* Holds if the specified location is in standard headers.
*/
predicate shouldDumpLocation(Location loc) {
not loc.getFile().getAbsolutePath().regexpMatch(".*/include/[^/]+")
predicate locationIsInStandardHeaders(Location loc) {
loc.getFile().getAbsolutePath().regexpMatch(".*/include/[^/]+")
}
/**
@@ -14,4 +12,4 @@ predicate shouldDumpLocation(Location loc) {
*
* This predicate excludes functions defined in standard headers.
*/
predicate shouldDumpFunction(Function func) { shouldDumpLocation(func.getLocation()) }
predicate shouldDumpFunction(Function func) { not locationIsInStandardHeaders(func.getLocation()) }

View File

@@ -3,5 +3,5 @@ private import semmle.code.cpp.ir.IR
private import PrintConfig
from Operand a
where shouldDumpLocation(a.getLocation())
where not locationIsInStandardHeaders(a.getLocation())
select a, a.getDumpString()