r255324 - Revert "[Modules] Fix regression when an elaborated-type-specifier mentions a hidden tag"

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 17:44:44 PST 2015


Author: benlangmuir
Date: Thu Dec 10 19:44:43 2015
New Revision: 255324

URL: http://llvm.org/viewvc/llvm-project?rev=255324&view=rev
Log:
Revert "[Modules] Fix regression when an elaborated-type-specifier mentions a hidden tag"

This is causing assertion failures; reverting until I can fix.

This reverts commit r255267

Removed:
    cfe/trunk/test/Modules/Inputs/elaborated-type-structs.h
    cfe/trunk/test/Modules/elaborated-type-specifier-from-hidden-module.m
Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Modules/Inputs/module.map

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=255324&r1=255323&r2=255324&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Dec 10 19:44:43 2015
@@ -12121,12 +12121,10 @@ Decl *Sema::ActOnTag(Scope *S, unsigned
 
     // In C++, we need to do a redeclaration lookup to properly
     // diagnose some problems.
-    // FIXME: this lookup is also used (with and without C++) to find a hidden
-    // declaration so that we don't get ambiguity errors when using a type
-    // declared by an elaborated-type-specifier.  In C that is not correct and
-    // we should instead merge compatible types found by lookup.
-    Previous.setRedeclarationKind(ForRedeclaration);
-    LookupQualifiedName(Previous, SearchDC);
+    if (getLangOpts().CPlusPlus) {
+      Previous.setRedeclarationKind(ForRedeclaration);
+      LookupQualifiedName(Previous, SearchDC);
+    }
   }
 
   // If we have a known previous declaration to use, then use it.

Removed: cfe/trunk/test/Modules/Inputs/elaborated-type-structs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/elaborated-type-structs.h?rev=255323&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/elaborated-type-structs.h (original)
+++ cfe/trunk/test/Modules/Inputs/elaborated-type-structs.h (removed)
@@ -1,3 +0,0 @@
-struct S1;
-struct S2 { int x; };
-struct S3 { int x; };

Modified: cfe/trunk/test/Modules/Inputs/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=255324&r1=255323&r2=255324&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/module.map Thu Dec 10 19:44:43 2015
@@ -386,10 +386,3 @@ module TypedefTag {
     header "typedef-tag-hidden.h"
   }
 }
-
-module ElaboratedTypeStructs {
-  module Empty {}
-  module Structs {
-    header "elaborated-type-structs.h"
-  }
-}

Removed: cfe/trunk/test/Modules/elaborated-type-specifier-from-hidden-module.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/elaborated-type-specifier-from-hidden-module.m?rev=255323&view=auto
==============================================================================
--- cfe/trunk/test/Modules/elaborated-type-specifier-from-hidden-module.m (original)
+++ cfe/trunk/test/Modules/elaborated-type-specifier-from-hidden-module.m (removed)
@@ -1,18 +0,0 @@
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify
-
- at import ElaboratedTypeStructs.Empty; // The structs are now hidden.
-struct S1 *x;
-struct S2 *y;
-// FIXME: compatible definition should not be an error.
-struct S2 { int x; }; // expected-error {{redefinition}}
-struct S3 *z;
-// Incompatible definition.
-struct S3 { float y; }; // expected-error {{redefinition}}
-// expected-note at elaborated-type-structs.h:* 2 {{previous definition is here}}
-
- at import ElaboratedTypeStructs.Structs;
-
-void useS1(struct S1 *x);
-void useS2(struct S2 *x);
-void useS2(struct S2 *x);




More information about the cfe-commits mailing list