r355721 - Revert "Recommit "Support attribute used in member funcs of class templates""

Rafael Auler via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 12:23:57 PST 2019


Author: rafauler
Date: Fri Mar  8 12:23:57 2019
New Revision: 355721

URL: http://llvm.org/viewvc/llvm-project?rev=355721&view=rev
Log:
Revert "Recommit "Support attribute used in member funcs of class templates""

There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.

This reverts commit 8297e93480c636dc90fd14653c5a66406193363f.

Removed:
    cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=355721&r1=355720&r2=355721&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Mar  8 12:23:57 2019
@@ -2232,20 +2232,6 @@ TemplateDeclInstantiator::VisitCXXMethod
     Owner->addDecl(Method);
   }
 
-  // PR17480: Honor the used attribute to instantiate member function
-  // definitions
-  if (Method->hasAttr<UsedAttr>()) {
-    if (const auto *A = dyn_cast<CXXRecordDecl>(Owner)) {
-      SourceLocation Loc;
-      if (const MemberSpecializationInfo *MSInfo =
-              A->getMemberSpecializationInfo())
-        Loc = MSInfo->getPointOfInstantiation();
-      else if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(A))
-        Loc = Spec->getPointOfInstantiation();
-      SemaRef.MarkFunctionReferenced(Loc, Method);
-    }
-  }
-
   return Method;
 }
 

Removed: cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp?rev=355720&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp (removed)
@@ -1,19 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
-
-// Check that PR17480 is fixed: __attribute__((used)) ignored in templated
-// classes
-namespace InstantiateUsedMemberDefinition {
-template <typename T>
-struct S {
-  int __attribute__((used)) f() {
-    return 0;
-  }
-};
-
-void test() {
-  // Check that InstantiateUsedMemberDefinition::S<int>::f() is defined
-  // as a result of the S class template implicit instantiation
-  // CHECK: define linkonce_odr i32 @_ZN31InstantiateUsedMemberDefinition1SIiE1fEv
-  S<int> inst;
-}
-} // namespace InstantiateUsedMemberDefinition




More information about the cfe-commits mailing list