summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2019-08-14 16:57:11 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2019-08-14 16:57:11 +0000
commitaa3855694ff45fc51bd71774c8bb15738b83ef16 (patch)
treed81ec80eb23fb10bd84987eff11e64f0dd74cdbf /clang/lib/Basic/IdentifierTable.cpp
parent4ae5efbe662e58836ac3a4f26467780990ca0ac2 (diff)
downloadbcm5719-llvm-aa3855694ff45fc51bd71774c8bb15738b83ef16.tar.gz
bcm5719-llvm-aa3855694ff45fc51bd71774c8bb15738b83ef16.zip
[Sema][ObjC] Fix a -Wformat false positive with localizedStringForKey
Only honour format_arg attributes on -[NSBundle localizedStringForKey] when its argument has a format specifier in it, otherwise its likely to just be a key to fetch localized strings. Fixes rdar://23622446 Differential revision: https://reviews.llvm.org/D27165 llvm-svn: 368878
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index ca9c71287ab..4aebea19924 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -412,6 +412,21 @@ public:
} // namespace clang.
+bool Selector::isKeywordSelector(ArrayRef<StringRef> Names) const {
+ assert(!Names.empty() && "must have >= 1 selector slots");
+ if (getNumArgs() != Names.size())
+ return false;
+ for (unsigned I = 0, E = Names.size(); I != E; ++I) {
+ if (getNameForSlot(I) != Names[I])
+ return false;
+ }
+ return true;
+}
+
+bool Selector::isUnarySelector(StringRef Name) const {
+ return isUnarySelector() && getNameForSlot(0) == Name;
+}
+
unsigned Selector::getNumArgs() const {
unsigned IIF = getIdentifierInfoFlag();
if (IIF <= ZeroArg)
OpenPOWER on IntegriCloud