Page MenuHomePhabricator

[clang] Fix wrong -Wunused-local-typedef warning if use is a dependent qialified identifier
Needs ReviewPublic

Authored by krisb on Nov 23 2021, 8:32 AM.



Attempt to fix Tom Smeding's example from

Given the case like this one:

struct A {
  void f() const {}

template <typename T>
void handler(const T &item) {
  using a_type_t = A;

int main() {

there is no way to know whether the typedef is used or not before
the templated context is instantiated.

Having this the patch proposes deffering all the diagnostics for
typedefs defined within a dependent context.

Diff Detail

Unit TestsFailed

7,030 msx64 debian > libFuzzer.libFuzzer::fork-ubsan.test
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/IntegerOverflowTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fork-ubsan.test.tmp-IntegerOverflowTest -fsanitize=signed-integer-overflow -fno-sanitize-recover=signed-integer-overflow

Event Timeline

krisb requested review of this revision.Nov 23 2021, 8:32 AM
krisb created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2021, 8:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
krisb updated this revision to Diff 391312.Dec 2 2021, 6:43 AM

Simplified diagnostic condition in TemplateDeclInstantiator::InstantiateTypedefNameDecl().