[clang][driver] Only warn once about invalid library values
authorTimm Bäder <tbaeder@redhat.com>
Tue, 2 Feb 2021 17:25:36 +0000 (18:25 +0100)
committerTimm Bäder <tbaeder@redhat.com>
Wed, 10 Feb 2021 05:19:52 +0000 (06:19 +0100)
commita6439b52088b1d58d8e7aa9891c9011648710593
treee869bf24de2d56b8747cc49d61eb6a19fb53c90c
parentfdfd6478372cdee1542495d042b454d54dabf68e
[clang][driver] Only warn once about invalid library values

Since ToolChain::GetCXXStdlibType() is a simple getter that might emit
the "invalid library name in argument" warning, it can conceivably be
called several times while initializing the build pipeline.

Before this patch, a simple 'clang++ -stdlib=foo ./test.cpp' would print
the warning twice, -rt=lib=foo would print 6 times.

Change this and always only print the warning once. Keep the rest of the
semantics of the functions.

Differential Revision: https://reviews.llvm.org/D95915
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/undefined-libs.cpp [new file with mode: 0644]