[PATCH] D33207: Fix an assertion failure in FormatASTNodeDiagnosticArgument.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 16 01:15:53 PDT 2017


alexfh added inline comments.


================
Comment at: test/SemaCXX/warn-shadow.cpp:214
+void handleLinkageSpec() {
+  typedef void externC; // expected-warning {{declaration shadows a typedef in linkage specification}}
+}
----------------
rsmith wrote:
> We should be producing a diagnostic talking about the enclosing namespace / TU scope, not the linkage specification. Whoever is emitting the diagnostic seems to be missing a call to `getRedeclContext()` -- although perhaps we could do that in the diagnostic code instead.
I tried skipping transparent declaration contexts in `FormatASTNodeDiagnosticArgument`, but this causes three tests fail due to skipped enumeration names:
  error: 'error' diagnostics expected but not seen: 
    File /src/tools/clang/test/Modules/Inputs/odr/b.h Line 5 (directive at /src/tools/clang/test/Modules/odr.cpp:21): 'E::e2' from module 'b' is not present in definition of 'E' in module 'a'
  error: 'error' diagnostics seen but not expected: 
    File /src/tools/clang/test/Modules/Inputs/odr/b.h Line 5: 'E::e2' from module 'b' is not present in definition of the global namespace in module 'a'

  error: 'error' diagnostics expected but not seen: 
    File /src/tools/clang/test/SemaCXX/nested-name-spec.cpp Line 434: no member named 'X2' in 'PR16951::enumerator_2'
  error: 'error' diagnostics seen but not expected: 
    File /src/tools/clang/test/SemaCXX/nested-name-spec.cpp Line 434: no member named 'X2' in namespace 'PR16951'

  error: 'error' diagnostics expected but not seen: 
    File /src/tools/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp Line 26 (directive at /src/tools/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp:25): no member named '~Colors' in 'Colors'
  error: 'error' diagnostics seen but not expected: 
    File /src/tools/clang/test/SemaTemplate/instantiate-non-dependent-types.cpp Line 26: no member named '~Colors' in the global namespace

This doesn't seem right, so I changed the code emitting `-Wshadow` to use `getRedeclContext()` instead. PTAL


https://reviews.llvm.org/D33207





More information about the cfe-commits mailing list