mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Use raw pointers for vectorX configuration instead
This is safe as these are from arg[] and sidesteps issues with nullptr.
This commit is contained in:
parent
233072f045
commit
5f30bd1f0d
1 changed files with 6 additions and 8 deletions
|
@ -46,10 +46,9 @@ struct GlobalOptions
|
||||||
int optimizationLevel = 1;
|
int optimizationLevel = 1;
|
||||||
int debugLevel = 1;
|
int debugLevel = 1;
|
||||||
|
|
||||||
std::string vectorLib;
|
const char* vectorLib;
|
||||||
std::string vectorCtor;
|
const char* vectorCtor;
|
||||||
std::string vectorType;
|
const char* vectorType;
|
||||||
|
|
||||||
} globalOptions;
|
} globalOptions;
|
||||||
|
|
||||||
static Luau::CompileOptions copts()
|
static Luau::CompileOptions copts()
|
||||||
|
@ -58,10 +57,9 @@ static Luau::CompileOptions copts()
|
||||||
result.optimizationLevel = globalOptions.optimizationLevel;
|
result.optimizationLevel = globalOptions.optimizationLevel;
|
||||||
result.debugLevel = globalOptions.debugLevel;
|
result.debugLevel = globalOptions.debugLevel;
|
||||||
|
|
||||||
// globalOptions outlive the CompileOptions, so it's safe to use string data pointers here
|
result.vectorLib = globalOptions.vectorLib;
|
||||||
result.vectorLib = globalOptions.vectorLib.empty() ? nullptr : globalOptions.vectorLib.c_str();
|
result.vectorCtor = globalOptions.vectorCtor;
|
||||||
result.vectorCtor = globalOptions.vectorCtor.c_str();
|
result.vectorType = globalOptions.vectorType;
|
||||||
result.vectorType = globalOptions.vectorType.c_str();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue