llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

clang/lib/Sema/SemaOpenMP.cpp:24351: pointless test ?

Open dcb314 opened this issue 2 years ago • 4 comments

Static analyser cppcheck says:

clang/lib/Sema/SemaOpenMP.cpp:24351:57: style: Same expression 'DepType!=OMPC_DOACROSS_source' found multiple times in chain of '&&' operators. [duplicateExpression]

Source code is

  if (DSAStack->getCurrentDirective() == OMPD_ordered &&
      DepType != OMPC_DOACROSS_source && DepType != OMPC_DOACROSS_sink &&
      DepType != OMPC_DOACROSS_sink_omp_cur_iteration &&
      DepType != OMPC_DOACROSS_source_omp_cur_iteration &&
      DepType != OMPC_DOACROSS_source) {

There is just a chance some other identifier was intended. On the other hand, if it is simple duplication, it can be removed.

dcb314 avatar Jan 30 '24 08:01 dcb314

@llvm/issue-subscribers-clang-frontend

Author: None (dcb314)

Static analyser cppcheck says:

clang/lib/Sema/SemaOpenMP.cpp:24351:57: style: Same expression 'DepType!=OMPC_DOACROSS_source' found multiple times in chain of '&&' operators. [duplicateExpression]

Source code is

if (DSAStack->getCurrentDirective() == OMPD_ordered && DepType != OMPC_DOACROSS_source && DepType != OMPC_DOACROSS_sink && DepType != OMPC_DOACROSS_sink_omp_cur_iteration && DepType != OMPC_DOACROSS_source_omp_cur_iteration && DepType != OMPC_DOACROSS_source) {

There is just a chance some other identifier was intended. On the other hand, if it is simple duplication, it can be removed.

llvmbot avatar Jan 30 '24 15:01 llvmbot

CC @jyu2-git who added this at f70967fd

RKSimon avatar Apr 05 '24 12:04 RKSimon

@jyu2-git gentle ping

https://github.com/llvm/llvm-project/blob/6c4dedde08686edea9a1d5173313f44ef23ee38e/clang/lib/Sema/SemaOpenMP.cpp#L24592-L24596

JOE1994 avatar May 03 '24 15:05 JOE1994

I see. I will fix it. Thanks.

jyu2-git avatar May 03 '24 16:05 jyu2-git