[all-commits] [llvm/llvm-project] 9aa3b5: [-Wunsafe-buffer-usage] Fix a small bug recently f...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Thu Aug 15 12:34:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9aa3b53ac52167aba6253a52805874948ce40c8f
      https://github.com/llvm/llvm-project/commit/9aa3b53ac52167aba6253a52805874948ce40c8f
  Author: Ziqing Luo <ziqing at udel.edu>
  Date:   2024-08-15 (Thu, 15 Aug 2024)

  Changed paths:
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-in-container-span-construct.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Fix a small bug recently found (#102953)

`QualType::isConstantArrayType()` checks canonical type. So a following
cast should be applied to canonical type as well:

```
if (Ty->isConstantArrayType())
  cast<ConstantArrayType>(Ty.getCanonicalType());  //  cast<ConstantArrayType>(Ty) is incorrect
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list