Index: cfe/trunk/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp =================================================================== --- cfe/trunk/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp +++ cfe/trunk/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp @@ -102,6 +102,10 @@ private: void handleCXXRecordDecl(const CXXRecordDecl *RecordDecl) { + if (!RecordDecl->getDefinition()) { + USRSet.insert(getUSRForDecl(RecordDecl)); + return; + } RecordDecl = RecordDecl->getDefinition(); if (const auto *ClassTemplateSpecDecl = dyn_cast(RecordDecl)) Index: cfe/trunk/test/clang-rename/ForwardClassDecl.cpp =================================================================== --- cfe/trunk/test/clang-rename/ForwardClassDecl.cpp +++ cfe/trunk/test/clang-rename/ForwardClassDecl.cpp @@ -0,0 +1,4 @@ +class Foo; // CHECK: class Bar; +Foo *f(); // CHECK: Bar *f(); + +// RUN: clang-rename -offset=6 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s