[PATCH] D56928: Support attribute used in member funcs of class templates

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 28 07:37:31 PST 2019


aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2182
+  if (Method->hasAttr<UsedAttr>()) {
+    if (auto *A = dyn_cast<CXXRecordDecl>(Owner)) {
+      SourceLocation Loc;
----------------
`const auto *`?


================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2184
+      SourceLocation Loc;
+      if (MemberSpecializationInfo *MSInfo = A->getMemberSpecializationInfo()) {
+        Loc = MSInfo->getPointOfInstantiation();
----------------
`const MemberSpecializationInfo  *`?


================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2186
+        Loc = MSInfo->getPointOfInstantiation();
+      } else if (ClassTemplateSpecializationDecl *Spec =
+                     dyn_cast<ClassTemplateSpecializationDecl>(A)) {
----------------
`const auto *`?


================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:2191
+
+      SemaRef.MarkFunctionReferenced(Loc, Method, /*MightBeOdrUse=*/true);
+    }
----------------
You can elide the last argument.


================
Comment at: test/CodeGenCXX/attr-used-member-function-implicit-instantiation.cpp:1
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -O0 -o - %s \
+// RUN:  | FileCheck %s
----------------
Meinersbur wrote:
> Could you mention PR17480 in this test file as well?
Also, can you bump this comment down below the RUN lines?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56928/new/

https://reviews.llvm.org/D56928





More information about the cfe-commits mailing list