[PATCH] D52973: Add type_info predefined decl
Matt Asplund via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 16 12:46:11 PDT 2018
mwasplund updated this revision to Diff 169879.
mwasplund marked 2 inline comments as done.
Repository:
rC Clang
https://reviews.llvm.org/D52973
Files:
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp
lib/Sema/SemaDecl.cpp
test/Modules/msvc-compat-implitic-types.cpp
Index: test/Modules/msvc-compat-implitic-types.cpp
===================================================================
--- /dev/null
+++ test/Modules/msvc-compat-implitic-types.cpp
@@ -0,0 +1,14 @@
+// Verify there is not collision between the
+// RUN: %clang -fms-compatibility -fmodules-ts -x c++-module --precompile -DEXPORT -o %t.pcm %s
+// RUN: %clang -fms-compatibility -fmodules-ts -fmodule-file=%t.pcm -c -DMAIN %s
+
+// expected-no-diagnostics
+
+#if EXPORT
+export module MyModule;
+export class MyClass {};
+#elif MAIN
+#include <iostream>
+#else
+#error MISSING DEFINE
+#endif
\ No newline at end of file
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -1464,11 +1464,6 @@
if (NewM == OldM)
return false;
- // FIXME: The Modules TS does not specify how to handle inplicit types
- // For now we will simply ignore the implicit global types
- if (Old->isImplicit())
- return false;
-
// FIXME: Check proclaimed-ownership-declarations here too.
bool NewIsModuleInterface = NewM && NewM->Kind == Module::ModuleInterfaceUnit;
bool OldIsModuleInterface = OldM && OldM->Kind == Module::ModuleInterfaceUnit;
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -1081,8 +1081,10 @@
}
RecordDecl *ASTContext::getTypeInfoClassDecl() const {
- if (!TypeInfoClassDecl)
+ if (!TypeInfoClassDecl) {
TypeInfoClassDecl = buildImplicitRecord("type_info", TTK_Class);
+ TypeInfoClassDecl->setModuleOwnershipKind(Decl::ModuleOwnershipKind::Unowned);
+ }
return TypeInfoClassDecl;
}
Index: include/clang/AST/ASTContext.h
===================================================================
--- include/clang/AST/ASTContext.h
+++ include/clang/AST/ASTContext.h
@@ -1126,7 +1126,7 @@
/// Retrieve the declaration for the 128-bit unsigned integer type.
TypedefDecl *getUInt128Decl() const;
- /// Retrieve the declaration for the type_info class type.
+ /// Retrieve the declaration for the MSVC ::type_info class type.
RecordDecl *getTypeInfoClassDecl() const;
//===--------------------------------------------------------------------===//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52973.169879.patch
Type: text/x-patch
Size: 2312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181016/ff7c0ee3/attachment.bin>
More information about the cfe-commits
mailing list