CodeQL library for C/C++
codeql/cpp-all 0.4.0-dev (changelog, source)
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)