[clang-tools-extra] 9b5a934 - [IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 01:20:57 PDT 2023


Author: Kadir Cetinkaya
Date: 2023-03-14T09:20:30+01:00
New Revision: 9b5a934def7ff02f51d972c80021c9d601f91beb

URL: https://github.com/llvm/llvm-project/commit/9b5a934def7ff02f51d972c80021c9d601f91beb
DIFF: https://github.com/llvm/llvm-project/commit/9b5a934def7ff02f51d972c80021c9d601f91beb.diff

LOG: [IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef

Fixes https://github.com/llvm/llvm-project/issues/61221

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp b/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
index 9961b013b24d..d69e25bf8116 100644
--- a/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/LocateSymbolTest.cpp
@@ -16,15 +16,11 @@
 #include "clang/Testing/TestAST.h"
 #include "clang/Tooling/Inclusions/StandardLibrary.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Testing/Annotations/Annotations.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
-#include <cstddef>
-#include <memory>
 #include <tuple>
-#include <unordered_map>
-#include <utility>
-#include <variant>
 #include <vector>
 
 namespace clang::include_cleaner {
@@ -66,8 +62,8 @@ struct LocateExample {
           ND = TD;
         if (ND->getName() == NameToFind) {
           EXPECT_TRUE(Out == nullptr || Out == ND->getCanonicalDecl())
-              << "Found multiple matches for " << NameToFind;
-          Out = cast<NamedDecl>(ND->getCanonicalDecl());
+              << "Found multiple matches for " << NameToFind.str();
+          Out = llvm::cast<NamedDecl>(ND->getCanonicalDecl());
         }
         return true;
       }


        


More information about the cfe-commits mailing list