[clang-tools-extra] 4ce6dfb - [include-cleaner] Add a unique_ptr-style member expr test in WalkASTTest.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 00:59:05 PST 2022


Author: Haojian Wu
Date: 2022-12-12T09:58:54+01:00
New Revision: 4ce6dfbcd6f0cbe8e03ecf6f99b306f6826bf239

URL: https://github.com/llvm/llvm-project/commit/4ce6dfbcd6f0cbe8e03ecf6f99b306f6826bf239
DIFF: https://github.com/llvm/llvm-project/commit/4ce6dfbcd6f0cbe8e03ecf6f99b306f6826bf239.diff

LOG: [include-cleaner] Add a unique_ptr-style member expr test in WalkASTTest.

This is a test I missed to mention in https://reviews.llvm.org/D139087.

Reviewed By: VitaNuo

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
index 551eb66bcdef0..a197c1b763ad8 100644
--- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -196,6 +196,20 @@ TEST(WalkAST, MemberExprs) {
            "Derived foo(); void fun() { foo().^a; }");
   testWalk("struct Base { int a; }; struct $explicit^Derived : public Base {};",
            "Derived& foo(); void fun() { foo().^a; }");
+  testWalk(R"cpp(
+      template <typename T>
+      struct unique_ptr {
+        T *operator->();
+      };
+      struct $explicit^Foo { int a; };)cpp",
+           "void test(unique_ptr<Foo> &V) { V->^a; }");
+  testWalk(R"cpp(
+      template <typename T>
+      struct $explicit^unique_ptr {
+        void release();
+      };
+      struct Foo {};)cpp",
+           "void test(unique_ptr<Foo> &V) { V.^release(); }");
 }
 
 TEST(WalkAST, ConstructExprs) {


        


More information about the cfe-commits mailing list