[clang-tools-extra] r345460 - [AST] Refactor PredefinedExpr

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 27 12:21:19 PDT 2018


Author: brunoricci
Date: Sat Oct 27 12:21:19 2018
New Revision: 345460

URL: http://llvm.org/viewvc/llvm-project?rev=345460&view=rev
Log:
[AST] Refactor PredefinedExpr

Make the following changes to PredefinedExpr:

1. Move PredefinedExpr below StringLiteral so that it can use its definition.
2. Rename IdentType to IdentKind to be more in line with clang's conventions,
   and propagate the change to its users.
3. Move the location and the IdentKind into the newly available space of
   the bit-fields of Stmt.
4. Only store the function name when needed. When parsing all of Boost,
   of the 1357 PredefinedExpr 919 have no function name.

Differential Revision: https://reviews.llvm.org/D53605

Reviewed By: rjmccall


Modified:
    clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp?rev=345460&r1=345459&r2=345460&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp Sat Oct 27 12:21:19 2018
@@ -73,8 +73,8 @@ void LambdaFunctionNameCheck::registerPP
 
 void LambdaFunctionNameCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *E = Result.Nodes.getNodeAs<PredefinedExpr>("E");
-  if (E->getIdentType() != PredefinedExpr::Func &&
-      E->getIdentType() != PredefinedExpr::Function) {
+  if (E->getIdentKind() != PredefinedExpr::Func &&
+      E->getIdentKind() != PredefinedExpr::Function) {
     // We don't care about other PredefinedExprs.
     return;
   }
@@ -91,7 +91,7 @@ void LambdaFunctionNameCheck::check(cons
        "inside a lambda, '%0' expands to the name of the function call "
        "operator; consider capturing the name of the enclosing function "
        "explicitly")
-      << PredefinedExpr::getIdentTypeName(E->getIdentType());
+      << PredefinedExpr::getIdentKindName(E->getIdentKind());
 }
 
 } // namespace bugprone




More information about the cfe-commits mailing list