[clang-tools-extra] r276866 - [clang-rename] skip CXXConversionDecl while searching for NamedDecl

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 06:37:22 PDT 2016


Author: omtcyfz
Date: Wed Jul 27 08:37:22 2016
New Revision: 276866

URL: http://llvm.org/viewvc/llvm-project?rev=276866&view=rev
Log:
[clang-rename] skip CXXConversionDecl while searching for NamedDecl

Modified:
    clang-tools-extra/trunk/clang-rename/USRFinder.cpp
    clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp

Modified: clang-tools-extra/trunk/clang-rename/USRFinder.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRFinder.cpp?rev=276866&r1=276865&r2=276866&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-rename/USRFinder.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRFinder.cpp Wed Jul 27 08:37:22 2016
@@ -52,8 +52,8 @@ public:
   // checking if the point lies within the length of the name of the declaration
   // and the start location is sufficient.
   bool VisitNamedDecl(const NamedDecl *Decl) {
-    return setResult(Decl, Decl->getLocation(),
-                     Decl->getNameAsString().length());
+    return dyn_cast<CXXConversionDecl>(Decl) ? true :
+        setResult(Decl, Decl->getLocation(), Decl->getNameAsString().length());
   }
 
   // Expression visitors:

Modified: clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp?rev=276866&r1=276865&r2=276866&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp (original)
+++ clang-tools-extra/trunk/test/clang-rename/UserDefinedConversion.cpp Wed Jul 27 08:37:22 2016
@@ -1,12 +1,10 @@
-// Currently unsupported test.
-// RUN: cat %s > %t.cpp
-// FIXME: clang-rename should handle conversions from a class type to another
-// type.
+// RUN: clang-rename -offset=143 -new-name=Bar %s -- | FileCheck %s
 
 class Foo {};             // CHECK: class Bar {};
 
-class Baz {               // CHECK: class Bar {
+class Baz {
   operator Foo() const {  // CHECK: operator Bar() const {
+// offset  ^
     Foo foo;              // CHECK: Bar foo;
     return foo;
   }




More information about the cfe-commits mailing list