llvm-project
ecb694de - [Clang][NFCI] Initialize PredefinedNames immediately (#183295)

Commit
2 days ago
[Clang][NFCI] Initialize PredefinedNames immediately (#183295) In isPredefinedUnsafeLibcFunc the set of predefined names is initialized lazily. However, this pattern is redundant as function-scope static variables are initialized on first pass through the control flow. This commit makes the variable constant, makes it a non-heap object, and initializes it immediately. This has the following benefits: - The initialization pattern cleaner and potentially easier for the compiler to optimize. - Making the variable const avoids it being used as mutable global state. - Having immediate initialization removes a potential race condition. Signed-off-by: Steffen Holst Larsen <sholstla@amd.com>
Author
Parents
Loading