CodeQL library for C/C++
Search

Predicate hasIncludeGuard

Holds if hf begins with an #ifndef or #if directive ifndef, to test the macro named includeGuard, and ends with the matching endif.

Import path

import semmle.code.cpp.headers.MultipleInclusion
predicate hasIncludeGuard(HeaderFile hf, PreprocessorDirective ifndef, PreprocessorEndif endif, string includeGuard)