Skip to content

Commit 36a1ac5

Browse files
authored
Merge pull request #331 from geoffw0/av-35b
CPP: Speed up startsWithIfndef.
2 parents 4dd868f + b8d7292 commit 36a1ac5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cpp/ql/src/semmle/code/cpp/headers/MultipleInclusion.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ pragma[noopt] predicate correctIncludeGuard(HeaderFile hf, PreprocessorDirective
114114
*/
115115
predicate startsWithIfndef(HeaderFile hf, PreprocessorDirective ifndef, string macroName) {
116116
ifndefDirective(ifndef, macroName) and
117-
ifndef.getFile() = hf and
118-
ifndef.getLocation().getStartLine() = min(int l | includeGuardRelevantLine(hf, l))
117+
exists(Location loc |
118+
loc = ifndef.getLocation() and
119+
loc.getFile() = hf and
120+
loc.getStartLine() = min(int l | includeGuardRelevantLine(hf, l))
121+
)
119122
}
120123

121124
private predicate endifLocation(PreprocessorEndif endif, File f, int line) {

0 commit comments

Comments
 (0)