PP #include: address PR feedback.
This commit is contained in:
parent
63204c2501
commit
facde2c804
5 changed files with 19 additions and 11 deletions
|
|
@ -221,7 +221,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
|
|||
language, infoSink, spvVersion, true, EShMsgDefault,
|
||||
true));
|
||||
|
||||
TShader::Includer includer;
|
||||
TShader::ForbidIncluder includer;
|
||||
TPpContext ppContext(*parseContext, "", includer);
|
||||
TScanContext scanContext(*parseContext);
|
||||
parseContext->setScanContext(&scanContext);
|
||||
|
|
@ -1217,7 +1217,7 @@ int ShCompile(
|
|||
compiler->infoSink.debug.erase();
|
||||
|
||||
TIntermediate intermediate(compiler->getLanguage());
|
||||
TShader::Includer includer;
|
||||
TShader::ForbidIncluder includer;
|
||||
bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, nullptr,
|
||||
"", optLevel, resources, defaultVersion, ENoProfile, false,
|
||||
forwardCompatible, messages, intermediate, includer);
|
||||
|
|
|
|||
|
|
@ -576,12 +576,12 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
|
|||
int TPpContext::CPPinclude(TPpToken* ppToken)
|
||||
{
|
||||
const TSourceLoc directiveLoc = ppToken->loc;
|
||||
bool addLocalSearch = true; // to additionally include the extra "" paths
|
||||
bool startWithLocalSearch = true; // to additionally include the extra "" paths
|
||||
int token = scanToken(ppToken);
|
||||
|
||||
// handle <header-name>-style #include
|
||||
if (token == '<') {
|
||||
addLocalSearch = false;
|
||||
startWithLocalSearch = false;
|
||||
token = scanHeaderName(ppToken, '>');
|
||||
}
|
||||
// otherwise ppToken already has the header name and it was "header-name" style
|
||||
|
|
@ -609,7 +609,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
|
|||
// Find the inclusion, first look in "Local" ("") paths, if requested,
|
||||
// otherwise, only search the "System" (<>) paths.
|
||||
TShader::Includer::IncludeResult* res = nullptr;
|
||||
if (addLocalSearch)
|
||||
if (startWithLocalSearch)
|
||||
res = includer.includeLocal(filename.c_str(), currentSourceFile.c_str(), includeStack.size() + 1);
|
||||
if (! res || res->headerName.empty()) {
|
||||
includer.releaseInclude(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue