aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorZiqing Luo <ziqing@udel.edu>2025-04-24 17:03:06 -0700
committerGitHub <noreply@github.com>2025-04-24 17:03:06 -0700
commitbe48c0df77413a237565a339c9ccc275b8256631 (patch)
tree08c397de16d0c12626aed3d54d0f2a6f5fef9e87 /clang/lib/Analysis
parent7122d9c5623f69a68817c38ecbe5cabd7ea13cd5 (diff)
downloadllvm-be48c0df77413a237565a339c9ccc275b8256631.zip
llvm-be48c0df77413a237565a339c9ccc275b8256631.tar.gz
llvm-be48c0df77413a237565a339c9ccc275b8256631.tar.bz2
[-Wunsafe-buffer-usage] Fix a bug that wrongly assumed CXXMethodDecl always has an identifier (#137248)
Fix a bug in UnsafeBufferUsage.cpp that wrongly assumed that CXXMethodDecl always has an identifier. rdar://149071318
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/UnsafeBufferUsage.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 4eaf8ba..5b72382 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -675,7 +675,7 @@ static bool isNullTermPointer(const Expr *Ptr) {
const CXXMethodDecl *MD = MCE->getMethodDecl();
const CXXRecordDecl *RD = MCE->getRecordDecl()->getCanonicalDecl();
- if (MD && RD && RD->isInStdNamespace())
+ if (MD && RD && RD->isInStdNamespace() && MD->getIdentifier())
if (MD->getName() == "c_str" && RD->getName() == "basic_string")
return true;
}