[clang-tools-extra] r324080 - [clang-tidy] Remove global constructor. No functionality change intended.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 2 05:23:24 PST 2018
Author: d0k
Date: Fri Feb 2 05:23:24 2018
New Revision: 324080
URL: http://llvm.org/viewvc/llvm-project?rev=324080&view=rev
Log:
[clang-tidy] Remove global constructor. No functionality change intended.
Modified:
clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp?rev=324080&r1=324079&r2=324080&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp Fri Feb 2 05:23:24 2018
@@ -37,8 +37,12 @@ namespace {
using llvm::APSInt;
} // namespace
-static const llvm::StringSet<> KnownBannedMacroNames = {"EAGAIN", "EWOULDBLOCK",
- "SIGCLD", "SIGCHLD"};
+static constexpr llvm::StringLiteral KnownBannedMacroNames[] = {
+ "EAGAIN",
+ "EWOULDBLOCK",
+ "SIGCLD",
+ "SIGCHLD",
+};
static bool incrementWithoutOverflow(const APSInt &Value, APSInt &Result) {
Result = Value;
@@ -318,13 +322,13 @@ AST_MATCHER(ConditionalOperator, conditi
AST_MATCHER(Expr, isMacro) { return Node.getExprLoc().isMacroID(); }
-AST_MATCHER_P(Expr, expandedByMacro, llvm::StringSet<>, Names) {
+AST_MATCHER_P(Expr, expandedByMacro, ArrayRef<llvm::StringLiteral>, Names) {
const SourceManager &SM = Finder->getASTContext().getSourceManager();
const LangOptions &LO = Finder->getASTContext().getLangOpts();
SourceLocation Loc = Node.getExprLoc();
while (Loc.isMacroID()) {
StringRef MacroName = Lexer::getImmediateMacroName(Loc, SM, LO);
- if (Names.count(MacroName))
+ if (llvm::is_contained(Names, MacroName))
return true;
Loc = SM.getImmediateMacroCallerLoc(Loc);
}
More information about the cfe-commits
mailing list