From 58c305f466d1f78adb10e7295b9bc9fc192a6e09 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 21 Aug 2020 12:42:10 -0400 Subject: [PATCH] Revert "Teach AttachPreviousImpl to inherit MSInheritanceAttr attribute" This reverts commit 7a527f17776be78ec44b88e82b39afb65fc148e4. It caused some buildbot failures: http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/13600 http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/20294 --- clang/lib/Serialization/ASTReaderDecl.cpp | 22 ------------------- .../test/Modules/Inputs/inherit-attribute/a.h | 10 --------- .../test/Modules/Inputs/inherit-attribute/b.h | 5 ----- .../test/Modules/Inputs/inherit-attribute/c.h | 1 - .../Inputs/inherit-attribute/module.modulemap | 3 --- clang/test/Modules/inherit-attribute.cpp | 20 ----------------- 6 files changed, 61 deletions(-) delete mode 100644 clang/test/Modules/Inputs/inherit-attribute/a.h delete mode 100644 clang/test/Modules/Inputs/inherit-attribute/b.h delete mode 100644 clang/test/Modules/Inputs/inherit-attribute/c.h delete mode 100644 clang/test/Modules/Inputs/inherit-attribute/module.modulemap delete mode 100644 clang/test/Modules/inherit-attribute.cpp diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index c7a009d1e50dc..d76182847e9de 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -281,9 +281,6 @@ namespace clang { static Decl *getMostRecentDeclImpl(...); static Decl *getMostRecentDecl(Decl *D); - static void mergeInheritableAttributes(ASTReader &Reader, Decl *D, - Decl *Previous); - template static void attachPreviousDeclImpl(ASTReader &Reader, Redeclarable *D, Decl *Previous, @@ -3514,19 +3511,6 @@ Decl *ASTReader::getMostRecentExistingDecl(Decl *D) { return ASTDeclReader::getMostRecentDecl(D->getCanonicalDecl()); } -void ASTDeclReader::mergeInheritableAttributes(ASTReader &Reader, Decl *D, - Decl *Previous) { - InheritableAttr *NewAttr = nullptr; - ASTContext &Context = Reader.getContext(); - const auto *IA = Previous->getAttr(); - - if (IA && !D->hasAttr()) { - NewAttr = cast(IA->clone(Context)); - NewAttr->setInherited(true); - D->addAttr(NewAttr); - } -} - template void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader, Redeclarable *D, @@ -3685,12 +3669,6 @@ void ASTDeclReader::attachPreviousDecl(ASTReader &Reader, Decl *D, if (auto *TD = dyn_cast(D)) inheritDefaultTemplateArguments(Reader.getContext(), cast(Previous), TD); - - // If any of the declaration in the chain contains an Inheritable attribute, - // it needs to be added to all the declarations in the redeclarable chain. - // FIXME: Only the logic of merging MSInheritableAttr is present, it should - // be extended for all inheritable attributes. - mergeInheritableAttributes(Reader, D, Previous); } template diff --git a/clang/test/Modules/Inputs/inherit-attribute/a.h b/clang/test/Modules/Inputs/inherit-attribute/a.h deleted file mode 100644 index 04aabe9e8c611..0000000000000 --- a/clang/test/Modules/Inputs/inherit-attribute/a.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef FOO -#define FOO - -class Foo { -public: - void step(int v); - Foo(); -}; - -#endif diff --git a/clang/test/Modules/Inputs/inherit-attribute/b.h b/clang/test/Modules/Inputs/inherit-attribute/b.h deleted file mode 100644 index 9cd1f55b9d33d..0000000000000 --- a/clang/test/Modules/Inputs/inherit-attribute/b.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "a.h" - -void bar() { - &Foo::step; -} diff --git a/clang/test/Modules/Inputs/inherit-attribute/c.h b/clang/test/Modules/Inputs/inherit-attribute/c.h deleted file mode 100644 index 2243de1baf9a0..0000000000000 --- a/clang/test/Modules/Inputs/inherit-attribute/c.h +++ /dev/null @@ -1 +0,0 @@ -#include "a.h" diff --git a/clang/test/Modules/Inputs/inherit-attribute/module.modulemap b/clang/test/Modules/Inputs/inherit-attribute/module.modulemap deleted file mode 100644 index 16481e2745dde..0000000000000 --- a/clang/test/Modules/Inputs/inherit-attribute/module.modulemap +++ /dev/null @@ -1,3 +0,0 @@ -module "b" { header "b.h" } - -module "c" { header "c.h" } diff --git a/clang/test/Modules/inherit-attribute.cpp b/clang/test/Modules/inherit-attribute.cpp deleted file mode 100644 index 34aa4670365ab..0000000000000 --- a/clang/test/Modules/inherit-attribute.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -triple x86_64-pc-windows-msvc-unknown -I%S\Inputs\inherit-attribute -fmodules-cache-path=%t \ -// RUN: -fimplicit-module-maps -fmodules-local-submodule-visibility %s -ast-dump-all \ -// RUN: | FileCheck %s - -#include "b.h" -#include "c.h" - -class Foo; - -Foo f; - -// CHECK: CXXRecordDecl {{.*}} imported in b {{.*}} Foo -// CHECK: MSInheritanceAttr {{[^()]*$}} - -// CHECK: CXXRecordDecl {{.*}} prev {{.*}} imported in c {{.*}} Foo -// CHECK: MSInheritanceAttr {{.*}} Inherited {{[^()]*$}} - -// CHECK: CXXRecordDecl {{.*}} col:7 referenced class Foo -// CHECK: MSInheritanceAttr {{.*}} Inherited {{[^()]*$}}