Revert "add ability to record accessed and declared "named defines""
This reverts commit e7350423067442f616431c1cdf4f18dd7990a491.
This commit is contained in:
parent
a1184ddd48
commit
1aaa3567d9
@ -3812,15 +3812,4 @@ const char* TIntermediate::getResourceName(TResourceType res)
|
||||
}
|
||||
|
||||
|
||||
// Access recorded named preprocessor-defines from the outside
|
||||
// -> needs to take into account, that the outside may want to use the set
|
||||
// even after the memory pool got released
|
||||
void TIntermediate::getAddDefines( std::unordered_set< std::string > &targetSet, const std::unordered_set< TString > &sourceSet ) const
|
||||
{
|
||||
targetSet.reserve( targetSet.size() + sourceSet.size() );
|
||||
for ( auto &i: sourceSet )
|
||||
targetSet.emplace( i.c_str() ); // need to convert from TString (pool-allocated) to normal std::basic_string, so it may be used after the pool is released
|
||||
}
|
||||
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
@ -637,11 +637,6 @@ public:
|
||||
const char* const implicitThisName;
|
||||
const char* const implicitCounterName;
|
||||
|
||||
void insertAccessedNamedDefine( const char *defName ) { accessedNamedDefines.emplace( defName ); }
|
||||
void insertDeclaredNamedDefine( const char *defName ) { declaredNamedDefines.emplace( defName ); }
|
||||
void getAddAccessedNamedDefines( std::unordered_set< std::string > &targetSet ) const { getAddDefines( targetSet, accessedNamedDefines ); }
|
||||
void getAddDeclaredNamedDefines( std::unordered_set< std::string > &targetSet ) const { getAddDefines( targetSet, declaredNamedDefines ); }
|
||||
|
||||
protected:
|
||||
TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
|
||||
void error(TInfoSink& infoSink, const char*);
|
||||
@ -670,7 +665,6 @@ protected:
|
||||
std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const;
|
||||
bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();}
|
||||
static const char* getResourceName(TResourceType);
|
||||
void getAddDefines( std::unordered_set< std::string > &targetSet, const std::unordered_set< TString > &sourceSet ) const;
|
||||
|
||||
const EShLanguage language; // stage, known at construction time
|
||||
EShSource source; // source language, known a bit later
|
||||
@ -749,9 +743,6 @@ protected:
|
||||
|
||||
bool needToLegalize;
|
||||
|
||||
// storage for (accessed/declared) "named defines"
|
||||
std::unordered_set< TString > accessedNamedDefines, declaredNamedDefines;
|
||||
|
||||
private:
|
||||
void operator=(TIntermediate&); // prevent assignments
|
||||
};
|
||||
|
||||
@ -102,8 +102,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
parseContext.ppError(ppToken->loc, "must be followed by macro name", "#define", "");
|
||||
return token;
|
||||
}
|
||||
bool inUserCode(ppToken->loc.string >= 0);
|
||||
if (inUserCode) {
|
||||
if (ppToken->loc.string >= 0) {
|
||||
// We are in user code; check for reserved name use:
|
||||
parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#define");
|
||||
}
|
||||
@ -187,11 +186,8 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
||||
}
|
||||
}
|
||||
*existing = mac;
|
||||
} else {
|
||||
} else
|
||||
addMacroDef(defAtom, mac);
|
||||
if ( inUserCode && mac.args.empty() && mac.body.atEnd() )
|
||||
parseContext.intermediate.insertDeclaredNamedDefine( atomStrings.getString( defAtom ) );
|
||||
}
|
||||
|
||||
return '\n';
|
||||
}
|
||||
@ -252,8 +248,6 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
|
||||
} else {
|
||||
ifdepth++;
|
||||
elsetracker++;
|
||||
if ( nextAtom != PpAtomIf && scanToken( ppToken ) == PpAtomIdentifier )
|
||||
parseContext.intermediate.insertAccessedNamedDefine( ppToken->name );
|
||||
}
|
||||
} else if (nextAtom == PpAtomEndif) {
|
||||
token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken));
|
||||
@ -426,7 +420,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
|
||||
|
||||
return token;
|
||||
}
|
||||
parseContext.intermediate.insertAccessedNamedDefine( ppToken->name );
|
||||
|
||||
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
|
||||
res = macro != nullptr ? !macro->undef : 0;
|
||||
token = scanToken(ppToken);
|
||||
@ -583,7 +577,6 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
|
||||
else
|
||||
parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifndef", "");
|
||||
} else {
|
||||
parseContext.intermediate.insertAccessedNamedDefine( ppToken->name );
|
||||
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
|
||||
token = scanToken(ppToken);
|
||||
if (token != '\n') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user