Tests for C++0x Confusion

I’m a bit confused about the organization of the C++0x tests. Under the clang/test directory I see the following seemingly C++0x related directories:

Lexer/
SemaCXX/
CodeGenCXX/
Fixit/
Lexer/
PCH/
Parser/
Preprocessor/
SemaTemplate/
(this is the one that confuses me the most, are thing organized by compiler arch, or by language/version?) CXX/

Am I in the dark on how these thing are organized?

You're mostly looking at a historical artifact.

When Clang started as a C/Obj-C compiler (C++ was meant to be in there, but wasn't really planned for), it had some test directories: Preprocessor, Lexer, Parser, Sema, and CodeGen. This made sense, because in C those components are pretty much completely distinct. We had the MinimalAction, which just provided enough semantic analysis to make C parsing work, so you could run the C parser without Sema. When ObjC became a reality, only Sema and CodeGen received a significant number of new tests, so SemaObjC and CodeGenObjC were added.
When C++ support came into being, SemaCXX and CodeGenCXX were added along the same lines of reasoning. Templates were so complex and demanded so many tests that SemaTemplate was split out of SemaCXX.
However, the organization as it is makes a lot less sense for C++ than for C. For C++, there's no real minimal analysis that you can use for parsing. Correctly parsing C++ already means understanding namespaces and templates. So MinimalAction fell into disuse and bitrot, and eventually the entire Action interface was removed. Sema became the only action. Anyway, because separating parser and sema tests for C++ doesn't make much sense, and to better get a feeling for test coverage, the CXX directory was introduced, which contains tests organized by where the feature they describe appears in the standard. (This happened long before removing Action, by the way.)

Nowadays, if you add a test for C++, it's best to add it to CXX. Occasionally we still add them to other directories, though: to PCH if it only tests PCH functionality, and to SemaCXX or CodeGenCXX if the test is not easily associated with a specific section of the standard. (Some features are all over the place.)

Hope that helps.

Sebastian

That absolutely helps. Thanks!

I'm a bit confused about the organization of the C++0x tests. Under
the clang/test directory I see the following seemingly C++0x related
directories:

Lexer/
SemaCXX/
CodeGenCXX/
Fixit/
Lexer/
PCH/
Parser/
Preprocessor/
SemaTemplate/
(this is the one that confuses me the most, are thing organized by
compiler arch, or by language/version?) CXX/

Am I in the dark on how these thing are organized?

You're mostly looking at a historical artifact.

When Clang started as a C/Obj-C compiler (C++ was meant to be in there,
but wasn't really planned for), it had some test directories:
Preprocessor, Lexer, Parser, Sema, and CodeGen. This made sense, because
in C those components are pretty much completely distinct. We had the
MinimalAction, which just provided enough semantic analysis to make C
parsing work, so you could run the C parser without Sema. When ObjC
became a reality, only Sema and CodeGen received a significant number of
new tests, so SemaObjC and CodeGenObjC were added.
When C++ support came into being, SemaCXX and CodeGenCXX were added
along the same lines of reasoning. Templates were so complex and
demanded so many tests that SemaTemplate was split out of SemaCXX.
However, the organization as it is makes a lot less sense for C++ than
for C. For C++, there's no real minimal analysis that you can use for
parsing. Correctly parsing C++ already means understanding namespaces
and templates. So MinimalAction fell into disuse and bitrot, and
eventually the entire Action interface was removed. Sema became the only
action. Anyway, because separating parser and sema tests for C++ doesn't
make much sense, and to better get a feeling for test coverage, the CXX
directory was introduced, which contains tests organized by where the
feature they describe appears in the standard. (This happened long
before removing Action, by the way.)

Might I propose then that a separate directory be created for the next C++ standard, as the layout of the current final draft proposal has significant differences with the C++03 standard.

We're trying to follow the draft.

Sebastian

To elaborate, while the standards still keep the same section names (I think?), we should probably converge on using the '0x paragraph numbers. If you see something under the wrong paragraph, it is acceptable to move it.

John.