Look up a function name in the symbol table, and make sure it is a function. Return the function symbol if found, otherwise nullptr.
| 8282 | // Return the function symbol if found, otherwise nullptr. |
| 8283 | // |
| 8284 | const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn) |
| 8285 | { |
| 8286 | if (symbolTable.isFunctionNameVariable(call.getName())) { |
| 8287 | error(loc, "can't use function syntax on variable", call.getName().c_str(), ""); |
| 8288 | return nullptr; |
| 8289 | } |
| 8290 | |
| 8291 | const TFunction* function = nullptr; |
| 8292 | |
| 8293 | // debugPrintfEXT has var args and is in the symbol table as "debugPrintfEXT()", |
| 8294 | // mangled to "debugPrintfEXT(" |
| 8295 | if (call.getName() == "debugPrintfEXT") { |
| 8296 | TSymbol* symbol = symbolTable.find("debugPrintfEXT(", &builtIn); |
| 8297 | if (symbol) |
| 8298 | return symbol->getAsFunction(); |
| 8299 | } |
| 8300 | // abortEXT has usage (var args) as similar as debugPrintfEXT. |
| 8301 | if (call.getName() == "abortEXT") { |
| 8302 | TSymbol* symbol = symbolTable.find("abortEXT(", &builtIn); |
| 8303 | if (symbol) |
| 8304 | return symbol->getAsFunction(); |
| 8305 | } |
| 8306 | |
| 8307 | // coopMatPerElementNV is variadic. There is some function signature error |
| 8308 | // checking in handleCoopMat2FunctionCall. |
| 8309 | if (call.getName() == "coopMatPerElementNV") { |
| 8310 | TSymbol* symbol = symbolTable.find("coopMatPerElementNV(", &builtIn); |
| 8311 | if (symbol) |
| 8312 | return symbol->getAsFunction(); |
| 8313 | } |
| 8314 | |
| 8315 | if (call.getName() == "saturatedConvertEXT") { |
| 8316 | TSymbol* symbol = symbolTable.find("saturatedConvertEXT(", &builtIn); |
| 8317 | if (symbol) |
| 8318 | return symbol->getAsFunction(); |
| 8319 | } |
| 8320 | |
| 8321 | bool explicitTypesEnabled = extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || |
| 8322 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8) || |
| 8323 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16) || |
| 8324 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32) || |
| 8325 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64) || |
| 8326 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16) || |
| 8327 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32) || |
| 8328 | extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64); |
| 8329 | |
| 8330 | if (isEsProfile()) |
| 8331 | function = (explicitTypesEnabled && version >= 310) |
| 8332 | ? findFunctionExplicitTypes(loc, call, builtIn) |
| 8333 | : ((extensionTurnedOn(E_GL_EXT_shader_implicit_conversions) && version >= 310) |
| 8334 | ? findFunction120(loc, call, builtIn) |
| 8335 | : findFunctionExact(loc, call, builtIn)); |
| 8336 | else if (version < 120) |
| 8337 | function = findFunctionExact(loc, call, builtIn); |
| 8338 | else if (version < 400) { |
| 8339 | bool needfindFunction400 = extensionTurnedOn(E_GL_ARB_gpu_shader_fp64) |
| 8340 | || extensionTurnedOn(E_GL_ARB_gpu_shader5) |
| 8341 | || extensionTurnedOn(E_GL_NV_gpu_shader5); |
nothing calls this directly
no test coverage detected