[PATCH] D52973: Add type_info predefined decl

Matt Asplund via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 7 19:53:25 PDT 2018


mwasplund created this revision.
Herald added a subscriber: cfe-commits.

Bug 39052 - [Modules TS] MSVC std library produces ambiguous type_info reference when including module with ms-compatibility

When compiling a modules-ts project with MSVC compatibility turned on the type_info class was getting defined multiple times. With this change I am adding the type_info class as a predefined decl to allow the reader/writer to resolve the duplicated declarations.

On top of this I am adding an extra check to ignore redeclaration checks on implicit types. This could be up for discussion since the spec does not specify if the implicit types should be in the global unit or if they can be overridden by the same type inside a module purview.


Repository:
  rC Clang

https://reviews.llvm.org/D52973

Files:
  lib/Sema/SemaDecl.cpp


Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -5235,7 +5235,7 @@
                                         DeclarationName Name,
                                         SourceLocation Loc, bool IsTemplateId) {
   DeclContext *Cur = CurContext;
-  while (Cur->isTransparentContext() || isa<CapturedDecl>(Cur))
+  while (isa<LinkageSpecDecl>(Cur) || isa<CapturedDecl>(Cur))
     Cur = Cur->getParent();
 
   // If the user provided a superfluous scope specifier that refers back to the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52973.168603.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181008/f6895e03/attachment.bin>


More information about the cfe-commits mailing list