Skip to content

[Sema][NFC] Move two misplaced uninit tests to clang/test/SemaCXX #128013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

NagyDonat
Copy link
Contributor

Because they are the last two remaining test files that appeared under clang/test/Analysis but were unrelated to the clang static analyzer. For background see the following discourse thread: https://discourse.llvm.org/t/taking-ownership-of-clang-test-analysis/84689/2

I placed them in in clang/test/SemaCXX because they are testing the -Wuninitialized warning family and the other tests of this feature can be found there (or in Sema, SemaObjC depending on the language).

Note that clang/test/Analysis contains many other test files named uninit-*, but those test the uninitialized value handling of the clang static analyzer, which is independent of the (non-path-sensitive) compiler warnings that are tested in the two files that I'm moving.

Also note that the implementation of the -Wuninitialized-like warnings relies on the source files clang/lib/Analysis/UninitializedValues.cpp and clang/lib/Sema/AnalysisBasedWarnings.cpp, and this would theoretically justify leaving their tests in the "Analysis" directory; but in practice the "Analysis" directory is almost exclusively used by the static analyzer, so I still decided to relocate these two tests for the sake of consistency.

Because they are the last two remaining test files that appeared under
`clang/test/Analysis` but were unrelated to the clang static analyzer.
For background see the following discourse thread:
https://discourse.llvm.org/t/taking-ownership-of-clang-test-analysis/84689/2

I placed them in in `clang/test/SemaCXX` because they are testing the
`-Wuninitialized` warning family and the other tests of this feature can
be found there (or in `Sema`, `SemaObjC` depending on the language).

Note that `clang/test/Analysis` contains many other test files named
`uninit-*`, but those test the uninitialized value handling of the clang
static analyzer, which is independent of the (non-path-sensitive)
compiler warnings that are tested in the two files that I'm moving.

Also note that the implementation of the `-Wuninitialized`-like warnings
relies on the source files `clang/lib/Analysis/UninitializedValues.cpp`
and `clang/lib/Sema/AnalysisBasedWarnings.cpp`, and this would
theoretically justify leaving their tests in the "Analysis" directory;
but in practice the "Analysis" directory is almost exclusively used by
the static analyzer, so I still decided to relocate these two tests for
the sake of consistency.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Feb 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 20, 2025

@llvm/pr-subscribers-clang

Author: Donát Nagy (NagyDonat)

Changes

Because they are the last two remaining test files that appeared under clang/test/Analysis but were unrelated to the clang static analyzer. For background see the following discourse thread: https://discourse.llvm.org/t/taking-ownership-of-clang-test-analysis/84689/2

I placed them in in clang/test/SemaCXX because they are testing the -Wuninitialized warning family and the other tests of this feature can be found there (or in Sema, SemaObjC depending on the language).

Note that clang/test/Analysis contains many other test files named uninit-*, but those test the uninitialized value handling of the clang static analyzer, which is independent of the (non-path-sensitive) compiler warnings that are tested in the two files that I'm moving.

Also note that the implementation of the -Wuninitialized-like warnings relies on the source files clang/lib/Analysis/UninitializedValues.cpp and clang/lib/Sema/AnalysisBasedWarnings.cpp, and this would theoretically justify leaving their tests in the "Analysis" directory; but in practice the "Analysis" directory is almost exclusively used by the static analyzer, so I still decided to relocate these two tests for the sake of consistency.


Full diff: https://github.com/llvm/llvm-project/pull/128013.diff

2 Files Affected:

  • (renamed) clang/test/SemaCXX/uninit-asm-goto.cpp ()
  • (renamed) clang/test/SemaCXX/uninit-sometimes.cpp ()
diff --git a/clang/test/Analysis/uninit-asm-goto.cpp b/clang/test/SemaCXX/uninit-asm-goto.cpp
similarity index 100%
rename from clang/test/Analysis/uninit-asm-goto.cpp
rename to clang/test/SemaCXX/uninit-asm-goto.cpp
diff --git a/clang/test/Analysis/uninit-sometimes.cpp b/clang/test/SemaCXX/uninit-sometimes.cpp
similarity index 100%
rename from clang/test/Analysis/uninit-sometimes.cpp
rename to clang/test/SemaCXX/uninit-sometimes.cpp

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, but I added some other folks just to sanity check.

@Xazax-hun
Copy link
Collaborator

Looks good! I wonder if we should rename the directory to something like clang/test/StaticAnalyzer to avoid confusion in the future.

@NagyDonat
Copy link
Contributor Author

I wonder if we should rename the directory to something like clang/test/StaticAnalyzer to avoid confusion in the future.

I also considered renaming the directory to clang/test/StaticAnalyzer and I would definitely support this idea if it doesn't cause too many difficulties in the maintenance of downstream forks.

@AaronBallman
Copy link
Collaborator

Looks good! I wonder if we should rename the directory to something like clang/test/StaticAnalyzer to avoid confusion in the future.

I think that's a good idea

@NagyDonat
Copy link
Contributor Author

I'm merging this now because I feel that the current reviews are sufficient for this simple NFC change. If there are any further observations/suggestions, feel free to mention them -- I can address them in a follow-up commit.

@NagyDonat NagyDonat merged commit c80b99d into llvm:main Feb 24, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants