HLSL: use prefix for builtin functions names to avoid namespace collisions
It would have been possible for globally scoped user functions to collide with builtin method names. This adds a prefix to avoid polluting the namespace. Ideally this would be an invalid character to use in user identifiers, but as that requires changing the scanner, for the moment it's an unlikely yet valid prefix.
This commit is contained in:
@@ -390,6 +390,12 @@ protected:
|
||||
TVector<TString> currentTypePrefix;
|
||||
};
|
||||
|
||||
// This is the prefix we use for builtin methods to avoid namespace collisions with
|
||||
// global scope user functions.
|
||||
// TODO: this would be better as a nonparseable character, but that would
|
||||
// require changing the scanner.
|
||||
#define BUILTIN_PREFIX "__BI_"
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // HLSL_PARSE_INCLUDED_
|
||||
|
||||
Reference in New Issue
Block a user