From d17e9c681bc448391b6a85fe7abdf6e180143393 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Fri, 11 Dec 2015 01:44:43 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255324 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 10 ++++------ test/Modules/Inputs/elaborated-type-structs.h | 3 --- test/Modules/Inputs/module.map | 7 ------- ...borated-type-specifier-from-hidden-module.m | 18 ------------------ 4 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 test/Modules/Inputs/elaborated-type-structs.h delete mode 100644 test/Modules/elaborated-type-specifier-from-hidden-module.m diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 1d8f9b7d20..af5fdc95c9 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -12121,12 +12121,10 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // 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. diff --git a/test/Modules/Inputs/elaborated-type-structs.h b/test/Modules/Inputs/elaborated-type-structs.h deleted file mode 100644 index da3940998f..0000000000 --- a/test/Modules/Inputs/elaborated-type-structs.h +++ /dev/null @@ -1,3 +0,0 @@ -struct S1; -struct S2 { int x; }; -struct S3 { int x; }; diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 632517dd36..226d45fdf4 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -386,10 +386,3 @@ module TypedefTag { header "typedef-tag-hidden.h" } } - -module ElaboratedTypeStructs { - module Empty {} - module Structs { - header "elaborated-type-structs.h" - } -} diff --git a/test/Modules/elaborated-type-specifier-from-hidden-module.m b/test/Modules/elaborated-type-specifier-from-hidden-module.m deleted file mode 100644 index 0ca1c24bba..0000000000 --- a/test/Modules/elaborated-type-specifier-from-hidden-module.m +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs %s -verify - -@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@elaborated-type-structs.h:* 2 {{previous definition is here}} - -@import ElaboratedTypeStructs.Structs; - -void useS1(struct S1 *x); -void useS2(struct S2 *x); -void useS2(struct S2 *x); -- 2.40.0