Eliminate Sema::KnownFunctionIDs, so that Sema doesn't end up pulling
in a bunch of declarations from the PCH file. We're down to loading
very few declarations in Carbon-prefixed "Hello, World!":
*** PCH Statistics:
6/20693 types read (0.028995%)
7/59230 declarations read (0.011818%)
50/44914 identifiers read (0.111324%)
0/32954 statements read (0.000000%)
5/6187 macros read (0.080815%)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69825 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index abde26a..040c546 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3114,31 +3114,15 @@
} else
return;
- unsigned KnownID;
- for (KnownID = 0; KnownID != id_num_known_functions; ++KnownID)
- if (KnownFunctionIDs[KnownID] == Name)
- break;
-
- switch (KnownID) {
- case id_NSLog:
- case id_NSLogv:
+ if (Name->isStr("NSLog") || Name->isStr("NSLogv")) {
if (const FormatAttr *Format = FD->getAttr<FormatAttr>()) {
// FIXME: We known better than our headers.
const_cast<FormatAttr *>(Format)->setType("printf");
} else
FD->addAttr(::new (Context) FormatAttr("printf", 1, 2));
- break;
-
- case id_asprintf:
- case id_vasprintf:
+ } else if (Name->isStr("asprintf") || Name->isStr("vasprintf")) {
if (!FD->getAttr<FormatAttr>())
FD->addAttr(::new (Context) FormatAttr("printf", 2, 3));
- break;
-
- default:
- // Unknown function or known function without any attributes to
- // add. Do nothing.
- break;
}
}