[cfe-dev] Tests for C++0x Confusion

Michael Price - Dev michael.b.price.dev at gmail.com
Mon Dec 20 03:58:52 PST 2010


On Dec 20, 2010, at 3:15 AM, Sebastian Redl <sebastian.redl at getdesigned.at 
 > wrote:

> On 19.12.2010 20:15, Michael Price wrote:
>> 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.

> 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
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list