CodeQL library for C/C++
codeql/cpp-all 2.0.2 (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)