llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.82k stars 11.45k forks source link

clang/lib/Sema/SemaOpenMP.cpp:7297: possible bitwise / boolean mixup ? #79965

Open dcb314 opened 7 months ago

dcb314 commented 7 months ago

Static analyser cppcheck says:

clang/lib/Sema/SemaOpenMP.cpp:7297:19: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]

Source code is

  bool IsTemplated = !TemplateParamLists.empty();
  if (IsTemplated &
      !DVScope.TI->isExtensionActive(
          llvm::omp::TraitProperty::implementation_extension_allow_templates))

Perhaps

  bool IsTemplated = !TemplateParamLists.empty();
  if (IsTemplated &&
      !DVScope.TI->isExtensionActive(
          llvm::omp::TraitProperty::implementation_extension_allow_templates))

with the && was intended ?

llvmbot commented 7 months ago

@llvm/issue-subscribers-clang-frontend

Author: None (dcb314)

Static analyser cppcheck says: clang/lib/Sema/SemaOpenMP.cpp:7297:19: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition] Source code is bool IsTemplated = !TemplateParamLists.empty(); if (IsTemplated & !DVScope.TI->isExtensionActive( llvm::omp::TraitProperty::implementation_extension_allow_templates)) Perhaps bool IsTemplated = !TemplateParamLists.empty(); if (IsTemplated && !DVScope.TI->isExtensionActive( llvm::omp::TraitProperty::implementation_extension_allow_templates)) with the && was intended ?
RKSimon commented 5 months ago

CC @jdoerfert who committed this at 5c1084e