Skip to content

Commit cb3ff9a

Browse files
authored
[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.
1 parent 7683a16 commit cb3ff9a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

clang/lib/Sema/SemaOpenMP.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -6198,18 +6198,17 @@ class TeamsLoopChecker final : public ConstStmtVisitor<TeamsLoopChecker> {
61986198
// unless the assume-no-nested-parallelism flag has been specified.
61996199
// OpenMP API runtime library calls do not inhibit parallel loop
62006200
// translation, regardless of the assume-no-nested-parallelism.
6201-
if (C) {
6202-
bool IsOpenMPAPI = false;
6203-
auto *FD = dyn_cast_or_null<FunctionDecl>(C->getCalleeDecl());
6204-
if (FD) {
6205-
std::string Name = FD->getNameInfo().getAsString();
6206-
IsOpenMPAPI = Name.find("omp_") == 0;
6207-
}
6208-
TeamsLoopCanBeParallelFor =
6209-
IsOpenMPAPI || SemaRef.getLangOpts().OpenMPNoNestedParallelism;
6210-
if (!TeamsLoopCanBeParallelFor)
6211-
return;
6212-
}
6201+
bool IsOpenMPAPI = false;
6202+
auto *FD = dyn_cast_or_null<FunctionDecl>(C->getCalleeDecl());
6203+
if (FD) {
6204+
std::string Name = FD->getNameInfo().getAsString();
6205+
IsOpenMPAPI = Name.find("omp_") == 0;
6206+
}
6207+
TeamsLoopCanBeParallelFor =
6208+
IsOpenMPAPI || SemaRef.getLangOpts().OpenMPNoNestedParallelism;
6209+
if (!TeamsLoopCanBeParallelFor)
6210+
return;
6211+
62136212
for (const Stmt *Child : C->children())
62146213
if (Child)
62156214
Visit(Child);

0 commit comments

Comments
 (0)