[clang] 3d9632a - [clang-rename] NFC, make getCanonicalSymbolDeclaration robust on nullptr input.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 25 05:33:20 PDT 2019
Author: Haojian Wu
Date: 2019-10-25T14:33:04+02:00
New Revision: 3d9632a997fb3d59f0740bb00817b5c6115674cb
URL: https://github.com/llvm/llvm-project/commit/3d9632a997fb3d59f0740bb00817b5c6115674cb
DIFF: https://github.com/llvm/llvm-project/commit/3d9632a997fb3d59f0740bb00817b5c6115674cb.diff
LOG: [clang-rename] NFC, make getCanonicalSymbolDeclaration robust on nullptr input.
Added:
Modified:
clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
index e26248f50c29..966833137c26 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))
More information about the cfe-commits
mailing list