george.karpenkov added inline comments.
================ Comment at: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp:618 + StringRef Name = FD->getIdentifier()->getName(); + int ArgIndex = llvm::StringSwitch<int>(Name) + .Case("sprintf", 1) ---------------- koldaniel wrote: > george.karpenkov wrote: > > That's a lot of duplication of 1/0/-1. > > > > > > And also 1/0/-1 are cryptic symbols, why not use an enum with a descriptive > > name? > > Maybe use > > `.Cases("sprintf", "vsprintf", "vfscanf", WARN_UNSAFE)` ? > The duplications will be solved by using .Cases, but is using enum necessary? > 1 and 0 refers to the index of the argument which could be a format string. > -1 means there is no need to look for a string like this. Right, then I guess 1 and 0 are self-descriptive, but I would still add a separate constant for `-1`. https://reviews.llvm.org/D35068 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits