[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:08:39 PDT 2017


alexfh updated this revision to Diff 99112.
alexfh added a comment.
Herald added a subscriber: krytarowski.

Instead of handling LinkageSpecDecl, use getRedeclContext() when issuing -Wshadow diagnostic.


https://reviews.llvm.org/D33207

Files:
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/warn-shadow.cpp


Index: test/SemaCXX/warn-shadow.cpp
===================================================================
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -206,3 +206,10 @@
 }
 
 }
+
+extern "C" {
+typedef int externC; // expected-note {{previous declaration is here}}
+}
+void handleLinkageSpec() {
+  typedef void externC; // expected-warning {{declaration shadows a typedef in the global namespace}}
+}
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -6942,7 +6942,7 @@
         }
     }
 
-  DeclContext *OldDC = ShadowedDecl->getDeclContext();
+  DeclContext *OldDC = ShadowedDecl->getDeclContext()->getRedeclContext();
 
   unsigned WarningDiag = diag::warn_decl_shadow;
   SourceLocation CaptureLoc;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33207.99112.patch
Type: text/x-patch
Size: 829 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170516/71c25521/attachment-0001.bin>


More information about the cfe-commits mailing list