Author: ioeric
Date: Tue Oct 10 06:00:18 2017
New Revision: 315308

URL: http://llvm.org/viewvc/llvm-project?rev=315308&view=rev
Log:
Revert "[Modules TS] Avoid computing the linkage of the enclosing DeclContext 
for a declaration in the global module."

This reverts commit r315256. See the original commit thread for reason.

Removed:
    cfe/trunk/test/Modules/anon-linkage.cpp
Modified:
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/include/clang/Sema/Sema.h
    cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=315308&r1=315307&r2=315308&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Tue Oct 10 06:00:18 2017
@@ -740,10 +740,7 @@ public:
 
   /// Get the module that owns this declaration for linkage purposes.
   /// There only ever is such a module under the C++ Modules TS.
-  ///
-  /// \param IgnoreLinkage Ignore the linkage of the entity; assume that
-  /// all declarations in a global module fragment are unowned.
-  Module *getOwningModuleForLinkage(bool IgnoreLinkage = false) const;
+  Module *getOwningModuleForLinkage() const;
 
   /// \brief Determine whether this declaration might be hidden from name
   /// lookup. Note that the declaration might be visible even if this returns

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=315308&r1=315307&r2=315308&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct 10 06:00:18 2017
@@ -3051,11 +3051,8 @@ public:
 
   RedeclarationKind forRedeclarationInCurContext() {
     // A declaration with an owning module for linkage can never link against
-    // anything that is not visible. We don't need to check linkage here; if
-    // the context has internal linkage, redeclaration lookup won't find things
-    // from other TUs, and we can't safely compute linkage yet in general.
-    if (cast<Decl>(CurContext)
-            ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
+    // anything that is not visible.
+    if (cast<Decl>(CurContext)->getOwningModuleForLinkage())
       return ForVisibleRedeclaration;
     return ForExternalRedeclaration;
   }

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=315308&r1=315307&r2=315308&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Oct 10 06:00:18 2017
@@ -1395,7 +1395,7 @@ LinkageInfo LinkageComputer::getDeclLink
                                             : NamedDecl::VisibilityForValue));
 }
 
-Module *Decl::getOwningModuleForLinkage(bool IgnoreLinkage) const {
+Module *Decl::getOwningModuleForLinkage() const {
   Module *M = getOwningModule();
   if (!M)
     return nullptr;
@@ -1413,8 +1413,6 @@ Module *Decl::getOwningModuleForLinkage(
     // for linkage purposes. But internal linkage declarations in the global
     // module fragment of a particular module are owned by that module for
     // linkage purposes.
-    if (IgnoreLinkage)
-      return nullptr;
     bool InternalLinkage;
     if (auto *ND = dyn_cast<NamedDecl>(this))
       InternalLinkage = !ND->hasExternalFormalLinkage();

Removed: cfe/trunk/test/Modules/anon-linkage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/anon-linkage.cpp?rev=315307&view=auto
==============================================================================
--- cfe/trunk/test/Modules/anon-linkage.cpp (original)
+++ cfe/trunk/test/Modules/anon-linkage.cpp (removed)
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -std=c++17 -fmodules-ts %s
-
-typedef struct {
-  int c;
-  union {
-    int n;
-    char c[4];
-  } v;
-} mbstate;
-
-export module M;
-export using ::mbstate;


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to