[clang-tools-extra] 5fdad8e - [clang-tidy] Fix check for generic lambda invented template parameters

Saar Raz via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 16:46:57 PST 2020


Author: Saar Raz
Date: 2020-01-22T02:46:39+02:00
New Revision: 5fdad8e3f803adce501ca25118f325184e54018d

URL: https://github.com/llvm/llvm-project/commit/5fdad8e3f803adce501ca25118f325184e54018d
DIFF: https://github.com/llvm/llvm-project/commit/5fdad8e3f803adce501ca25118f325184e54018d.diff

LOG: [clang-tidy] Fix check for generic lambda invented template parameters

clang-tidy previously relied on there being no identifier for a TemplateTypeParmDecl for checking
whether 'decltype(x)' should be inserted, instead of checking whether or not it is implicit.

D65042 added new names for invented generic lambda template parameters, rendering that check incorrect.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
index bf6f2f6ed035..8953f95159a9 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
@@ -33,7 +33,7 @@ static void replaceMoveWithForward(const UnresolvedLookupExpr *Callee,
 
   if (CallRange.isValid()) {
     const std::string TypeName =
-        TypeParmDecl->getIdentifier()
+        (TypeParmDecl->getIdentifier() && !TypeParmDecl->isImplicit())
             ? TypeParmDecl->getName().str()
             : (llvm::Twine("decltype(") + ParmVar->getName() + ")").str();
 


        


More information about the cfe-commits mailing list