mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: don't use llvm::StringSwitch for runtime function names
Using `llvm::StringSwitch` with this many cases causes clang to crash due to a stack overflow. Works around rdar://143944155
This commit is contained in:
@@ -2520,14 +2520,14 @@ static bool canDeclareSymbolName(StringRef symbol, ModuleDecl *fromModule) {
|
|||||||
// to predict ways. Warn when code attempts to do so; hopefully we can
|
// to predict ways. Warn when code attempts to do so; hopefully we can
|
||||||
// promote this to an error after a while.
|
// promote this to an error after a while.
|
||||||
|
|
||||||
return llvm::StringSwitch<bool>(symbol)
|
|
||||||
#define FUNCTION(_, Module, Name, ...) \
|
#define FUNCTION(_, Module, Name, ...) \
|
||||||
.Case(#Name, false) \
|
if (symbol == #Name) { return false; } \
|
||||||
.Case("_" #Name, false) \
|
if (symbol == "_" #Name) { return false; } \
|
||||||
.Case(#Name "_", false) \
|
if (symbol == #Name "_") { return false; } \
|
||||||
.Case("_" #Name "_", false)
|
if (symbol == "_" #Name "_") { return false; }
|
||||||
#include "swift/Runtime/RuntimeFunctions.def"
|
#include "swift/Runtime/RuntimeFunctions.def"
|
||||||
.Default(true);
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttributeChecker::visitCDeclAttr(CDeclAttr *attr) {
|
void AttributeChecker::visitCDeclAttr(CDeclAttr *attr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user