Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error
Li, Charles via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 17 09:56:33 PDT 2015
Hi Clang developers,
We here at Sony are continuing to update the Lit tests for C++ dialects compatibility.
Attached is the second patch. (As a reference, here is the link to the discussion on the previous Lit patch. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150727/134667.html)
In this second patch, there is 1 complicated change and 3 simple changes.
Here is the complicated change first.
test/Sema/switch-1.c
This test verifies the diagnostics for integer overflows.
Due to C++11's more strict requirements on constant-expressions in 5.19p2 [expr.const],
The diagnostics have changed from "overflow in expression" to "not a constant expression".
Usually we would create a C++11 version of the switch-1.c file.
But here we propose a novel approach to "#ifdef" the expected diagnostics. (We hope to use this approach for all similar cases in the future.)
Normally '// expected-error' does not honor any '#ifdef'.
But if we first preprocess the source into a temporary file, only the valid '#ifdef' sections remain.
We then run the preprocessed file at the desired dialect.
The main downside to this approach is If the test fails, the errors are reported on the temporary file, not on the original file, and the line numbers of these two files do not match
Here are the simple changes.
test/Analysis/temp-obj-dtors-cfg-output.cpp
This test verifies CFG dump for temporary destructors
C++11 no longer has the following implicit cast.
(ImplicitCastExpr, NoOp, const struct D)
We modified the test using the #ifdef approach to have the preprocessor generate the desired CHECK lines.
test/CodeCompletion/ordinary-name.cpp
This test verifies for code completion patterns.
Since C++11 has more keywords than C++98,
We made this test to be C++98 specific, and create a separate C++11 version.
test/CodeCompletion/ordinary-name-cxx11.cpp
This is the C++11 specific version of the code completion.
This test added patterns for the following keywords:
char16, char32, noexcept, nullptr, sizeof...,
auto, decltype, char16_t, char32_t
test/Sema/thread-specifier.c
Tests for __thread specifier at various C++ dialects
We made the default RUN line explicit to be at -std=c++98
If there is anything that seems confusing to you, please let me know.
I would be more than happy to expand on the reasons for the these changes.
Thanks,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150817/cfb89e6f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lit_22.patch
Type: application/octet-stream
Size: 23358 bytes
Desc: lit_22.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150817/cfb89e6f/attachment-0001.obj>
More information about the cfe-commits
mailing list