This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Remove uses of 'using namespace std;' in the test suite
ClosedPublic

Authored by ldionne on Sep 1 2021, 6:45 PM.

Diff Detail

Event Timeline

ldionne created this revision.Sep 1 2021, 6:45 PM
ldionne requested review of this revision.Sep 1 2021, 6:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 6:45 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone requested changes to this revision.Sep 2 2021, 6:52 AM
Quuxplusone added a subscriber: Quuxplusone.
Quuxplusone added inline comments.
libcxx/test/libcxx/numerics/c.math/fdelayed-template-parsing.pass.cpp
27

This can't possibly have been accidental, can it? What's the subtle point of this test?

libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
26

You don't need the std:: on size_t. (Compare line 29, where you left it off and it was totally fine.)
Some people put it religiously; I personally omit it religiously (on analogy to int, and because I like typing less).
Anyway, consider making lines 25 and 29 consistent (but it doesn't matter).

libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
35

This must have been intentional — trying to verify that we get no ambiguity from lookup finding both std::swap and std::filesystem::swap?? — but in this case I'm fairly sure I understand the issues involved and agree that deleting this line is fine.

Alternatively, delete using namespace fs; but keep using namespace std; — then we'd be testing that the "std::swap two-step" correctly works with path the same way it works with other types.

Obviously lines 41-42 should be made consistent with whatever you choose to do here.

libcxx/test/std/numerics/complex.number/complex.literals/literals2.pass.cpp
10

:shipit:

libcxx/test/std/strings/basic.string.literals/literal3.pass.cpp
1

No, this one is 100% intentional. Compare literal1.cpp.
However, please add comments to each of the files... and IMHO ideally combine them into just one file, so that it will be more obvious in the future what's supposed to be different between each file.

libcxx/test/std/strings/string.view/string_view.literals/literal3.pass.cpp
1

Ditto.

libcxx/test/support/any_helpers.h
93

Oho. This double-using idiom must date back to when std::experimental::any_cast was a thing. We don't have to worry about that anymore, right?

This revision now requires changes to proceed.Sep 2 2021, 6:52 AM
ldionne updated this revision to Diff 370310.Sep 2 2021, 9:54 AM
ldionne marked 7 inline comments as done.

Address comments

libcxx/test/libcxx/numerics/c.math/fdelayed-template-parsing.pass.cpp
27

Indeed, good catch. I did some archeology and improved the comment at the top instead.

libcxx/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp
26

When I include <cxxxxx>, I use the stuff in namespace std:: as a matter of consistency.

libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
35

I actually added a test that checks the swap two-step but also left this one.

libcxx/test/std/strings/basic.string.literals/literal3.pass.cpp
1

Hmm, right indeed -- I went a bit quickly with this patch, thanks for looking at it diligently. I fixed it, look in the next update.

libcxx/test/support/any_helpers.h
93

Right, that was my thinking too.

ldionne accepted this revision.Sep 3 2021, 10:14 AM
This revision was not accepted when it landed; it landed in state Needs Review.Sep 3 2021, 10:15 AM
This revision was automatically updated to reflect the committed changes.
libcxx/test/std/strings/string.view/string_view.literals/literal1.pass.cpp