[clang] cb3ff9a - [clang][OpenMP][NFC] Remove unnecessary nullptr check (#94680)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 08:12:16 PDT 2024
Author: Mike Rice
Date: 2024-06-10T08:12:12-07:00
New Revision: cb3ff9a3936d31c986fbfa5757c09e585669dc1e
URL: https://github.com/llvm/llvm-project/commit/cb3ff9a3936d31c986fbfa5757c09e585669dc1e
DIFF: https://github.com/llvm/llvm-project/commit/cb3ff9a3936d31c986fbfa5757c09e585669dc1e.diff
LOG: [clang][OpenMP][NFC] Remove unnecessary nullptr check (#94680)
Static verifier reports unchecked use of pointer after explicitly
checking earlier in the function. It appears the pointer won't be a
nullptr, so remove the unneeded check for consistency.
Added:
Modified:
clang/lib/Sema/SemaOpenMP.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 6e6815328e913..5af32cb3589d3 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -6198,18 +6198,17 @@ class TeamsLoopChecker final : public ConstStmtVisitor<TeamsLoopChecker> {
// unless the assume-no-nested-parallelism flag has been specified.
// OpenMP API runtime library calls do not inhibit parallel loop
// translation, regardless of the assume-no-nested-parallelism.
- if (C) {
- bool IsOpenMPAPI = false;
- auto *FD = dyn_cast_or_null<FunctionDecl>(C->getCalleeDecl());
- if (FD) {
- std::string Name = FD->getNameInfo().getAsString();
- IsOpenMPAPI = Name.find("omp_") == 0;
- }
- TeamsLoopCanBeParallelFor =
- IsOpenMPAPI || SemaRef.getLangOpts().OpenMPNoNestedParallelism;
- if (!TeamsLoopCanBeParallelFor)
- return;
- }
+ bool IsOpenMPAPI = false;
+ auto *FD = dyn_cast_or_null<FunctionDecl>(C->getCalleeDecl());
+ if (FD) {
+ std::string Name = FD->getNameInfo().getAsString();
+ IsOpenMPAPI = Name.find("omp_") == 0;
+ }
+ TeamsLoopCanBeParallelFor =
+ IsOpenMPAPI || SemaRef.getLangOpts().OpenMPNoNestedParallelism;
+ if (!TeamsLoopCanBeParallelFor)
+ return;
+
for (const Stmt *Child : C->children())
if (Child)
Visit(Child);
More information about the cfe-commits
mailing list