MCPcopy Create free account
hub / github.com/csyonghe/Spire / HandleIfNDefDirective

Function HandleIfNDefDirective

Source/SpireCore/Preprocessor.cpp:1252–1262  ·  view source on GitHub ↗

Handle a `#ifndef` directive

Source from the content-addressed store, hash-verified

1250
1251// Handle a `#ifndef` directive
1252static void HandleIfNDefDirective(PreprocessorDirectiveContext* context)
1253{
1254 // Expect a raw identifier, so we can check if it is defined
1255 Token nameToken;
1256 if(!ExpectRaw(context, TokenType::Identifier, Diagnostics::expectedTokenInPreprocessorDirective, &nameToken))
1257 return;
1258 String name = nameToken.Content;
1259
1260 // Check if the name is defined.
1261 BeginConditional(context, LookupMacro(context, name) == NULL);
1262}
1263
1264// Handle a `#else` directive
1265static void HandleElseDirective(PreprocessorDirectiveContext* context)

Callers

nothing calls this directly

Calls 3

ExpectRawFunction · 0.85
BeginConditionalFunction · 0.85
LookupMacroFunction · 0.85

Tested by

no test coverage detected