aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/ThreadSafety.cpp
diff options
context:
space:
mode:
authorManna, Soumi <soumi.manna@intel.com>2023-06-22 12:52:25 -0700
committerManna, Soumi <soumi.manna@intel.com>2023-06-22 12:58:38 -0700
commit982a87ab74d8d050ae56164fcead7cf19038b077 (patch)
tree2a0180e3b0a0c805802772a2fb87a4be6e4e21df /clang/lib/Analysis/ThreadSafety.cpp
parent30ac031dd5731fab02739ebe8a7dc9a013d008dc (diff)
downloadllvm-982a87ab74d8d050ae56164fcead7cf19038b077.zip
llvm-982a87ab74d8d050ae56164fcead7cf19038b077.tar.gz
llvm-982a87ab74d8d050ae56164fcead7cf19038b077.tar.bz2
[CLANG] Fix potential null pointer dereference bugs
This patch uses castAs instead of getAs which will assert if the type doesn't match and adds nullptr check if needed. Also this patch improves the codes and passes I.getData() instead of doing a lookup in dumpVarDefinitionName() since we're iterating over the same map in LocalVariableMap::dumpContex(). Reviewed By: aaron.ballman, aaronpuchert Differential Revision: https://reviews.llvm.org/D153033
Diffstat (limited to 'clang/lib/Analysis/ThreadSafety.cpp')
-rw-r--r--clang/lib/Analysis/ThreadSafety.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index ef7d2cf..087994e 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -502,9 +502,8 @@ public:
for (Context::iterator I = C.begin(), E = C.end(); I != E; ++I) {
const NamedDecl *D = I.getKey();
D->printName(llvm::errs());
- const unsigned *i = C.lookup(D);
llvm::errs() << " -> ";
- dumpVarDefinitionName(*i);
+ dumpVarDefinitionName(I.getData());
llvm::errs() << "\n";
}
}