[PATCH] [clang-tidy] Fix for llvm.org/PR23355

Alexander Kornienko alexfh at google.com
Tue May 26 07:36:01 PDT 2015


Thanks!

Looks good with one nit.


================
Comment at: clang-tidy/misc/AssertSideEffectCheck.cpp:59
@@ +58,3 @@
+    if (const auto *FuncDecl = CExpr->getDirectCallee()) {
+      const std::string FunctionName = FuncDecl->getNameInfo().getAsString();
+      if (FunctionName == "__builtin_expect") // exceptions come here
----------------
There's no need to use `getAsString()`, as you're only checking whether it's a specific unqualified name. I'd try to use the more effective version: `getName()`. Something along the lines of:

  if (FuncDecl->getDeclName().isIdentifier() && FuncDecl->getName() == "...") 
    ...

http://reviews.llvm.org/D9959

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list