diff options
Diffstat (limited to 'clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp')
-rw-r--r-- | clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp index e26248f50c29..d966a5ef23c2 100644 --- a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp +++ b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp @@ -39,6 +39,8 @@ namespace clang { namespace tooling { const NamedDecl *getCanonicalSymbolDeclaration(const NamedDecl *FoundDecl) { + if (!FoundDecl) + return nullptr; // If FoundDecl is a constructor or destructor, we want to instead take // the Decl of the corresponding class. if (const auto *CtorDecl = dyn_cast<CXXConstructorDecl>(FoundDecl)) @@ -65,7 +67,7 @@ public: std::vector<std::string> Find() { // Fill OverriddenMethods and PartialSpecs storages. - TraverseDecl(Context.getTranslationUnitDecl()); + TraverseAST(Context); if (const auto *MethodDecl = dyn_cast<CXXMethodDecl>(FoundDecl)) { addUSRsOfOverridenFunctions(MethodDecl); for (const auto &OverriddenMethod : OverriddenMethods) { |