[PATCH] D11572: [Static Analyzer] Checker for OS X / iOS localizability issues
Devin Coughlin via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 11:18:12 PDT 2015
dcoughlin added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp:68
@@ +67,3 @@
+ // Methods that require a localized string
+ mutable llvm::StringMap<llvm::StringMap<uint8_t>> UIMethods;
+ // Methods that return a localized string
----------------
FWIW,
#include "llvm/ADT/StringSet.h"
and using
mutable llvm::StringMap<llvm::StringSet<>> UIMethods;
works for me.
================
Comment at: lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp:72
@@ +71,3 @@
+ // C Functions that return a localized string
+ mutable llvm::StringMap<char> LSF;
+
----------------
Is there a reason you use StringMap<char> here and StringMap<uint8_t> for UIMethods?
================
Comment at: lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp:279
@@ +278,3 @@
+ std::string SelectorString = S.getAsString();
+ StringRef SelectorName = StringRef(SelectorString);
+ assert(!SelectorName.empty());
----------------
You can just write
StringRef SelectorName = SelectorString;
here.
================
Comment at: lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp:509
@@ +508,3 @@
+ StringRef(ME->getSelector().getAsString())
+ .equals("localizedStringForKey:value:table:"))) {
+ return;
----------------
You can just write
ME->getSelector().getAsString() == "localizedStringForKey:value:table:"
for the string comparison.
http://reviews.llvm.org/D11572
More information about the cfe-commits
mailing list