[all-commits] [llvm/llvm-project] a813a4: [clang] Combine ConstRefUse with other warnings fo...

Igor Kudrin via All-commits all-commits at lists.llvm.org
Wed Jul 9 23:28:41 PDT 2025


  Branch: refs/heads/users/ikudrin/combine-uninitialized-warns
  Home:   https://github.com/llvm/llvm-project
  Commit: a813a4c665579b3654b287ff64c8180139879a38
      https://github.com/llvm/llvm-project/commit/a813a4c665579b3654b287ff64c8180139879a38
  Author: Igor Kudrin <ikudrin at accesssoftek.com>
  Date:   2025-07-09 (Wed, 09 Jul 2025)

  Changed paths:
    M clang/include/clang/Analysis/Analyses/UninitializedValues.h
    M clang/lib/Analysis/UninitializedValues.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    A clang/test/SemaCXX/uninitialized-self-init.cpp
    M clang/test/SemaCXX/warn-uninitialized-const-reference.cpp

  Log Message:
  -----------
  [clang] Combine ConstRefUse with other warnings for uninitialized values

This helps to avoid duplicating warnings in cases like:
```
> cat test.cpp
void bar(int);
void foo(const int &);
void test(bool a) {
  int v = v;
  if (a)
    bar(v);
  else
    foo(v);
}
> clang++.exe test.cpp -fsyntax-only -Wuninitialized
test.cpp:4:11: warning: variable 'v' is uninitialized when used within its own initialization [-Wuninitialized]
    4 |   int v = v;
      |       ~   ^
test.cpp:4:11: warning: variable 'v' is uninitialized when used within its own initialization [-Wuninitialized]
    4 |   int v = v;
      |       ~   ^
2 warnings generated.
```



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