File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -514,6 +514,19 @@ class visitor : public clang::RecursiveASTVisitor<visitor> {
514
514
return true ;
515
515
}
516
516
517
+ // Visit every unresolved member expression in the compilation unit to
518
+ // determine if there are overloaded private methods that might be called. In
519
+ // this uncommon case, the private method should be annotated.
520
+ bool VisitUnresolvedMemberExpr (clang::UnresolvedMemberExpr *E) {
521
+ // Iterate over potential declarations
522
+ for (const clang::NamedDecl *ND : E->decls ())
523
+ if (const auto *MD = llvm::dyn_cast<clang::CXXMethodDecl>(ND))
524
+ if (MD->getAccess () == clang::AccessSpecifier::AS_private)
525
+ export_function_if_needed (MD);
526
+
527
+ return true ;
528
+ }
529
+
517
530
// Visit every constructor call in the compilation unit to determine if there
518
531
// are any inline calls to private constructors. In this uncommon case, the
519
532
// private constructor must be annotated for export. Constructor calls are not
Original file line number Diff line number Diff line change
1
+ // RUN: %idt --export-macro IDT_TEST_ABI %s 2>&1 | %FileCheck %s
2
+
3
+ class TemplateCallsPrivateMethod {
4
+ public:
5
+ // CHECK-NOT: TemplateCallsPrvateMethod.hh:[[@LINE+1]]:{{.*}}
6
+ template <typename T> void publicTemplateMethod (T x) {
7
+ privateMethodForTemplate (x);
8
+ }
9
+
10
+ private:
11
+ // NOTE: we use CHECK-DAG here because these remarks may come out of order and
12
+ // we cannot control the order by rearranging members.
13
+
14
+ // CHECK-DAG: TemplateCallsPrivateMethod.hh:[[@LINE+1]]:3: remark: unexported public interface 'privateMethodForTemplate'
15
+ void privateMethodForTemplate (long x) const ;
16
+
17
+ // CHECK-DAG: TemplateCallsPrivateMethod.hh:[[@LINE+1]]:3: remark: unexported public interface 'privateMethodForTemplate'
18
+ void privateMethodForTemplate (int x) const ;
19
+ };
20
+
You can’t perform that action at this time.
0 commit comments