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

Szabolcs Sipos szabolcs.sipos at ericsson.com
Fri May 29 03:04:38 PDT 2015


Committed in r238548.


================
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
----------------
alexfh wrote:
> 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() == "...") 
>     ...
Thanks. Changed it as you suggested.

http://reviews.llvm.org/D9959

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






More information about the cfe-commits mailing list