summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-12-16 01:15:01 +0000
committerHans Wennborg <hans@hanshq.net>2014-12-16 01:15:01 +0000
commit45810b463130453c9e84a8fad213106c75cb71cb (patch)
tree05dd265494bc3222b5f6025d8b72b82068aa7278 /clang/lib/Sema/SemaDeclCXX.cpp
parentc971338def50e7e5e93fee44a611df783189b2ee (diff)
downloadbcm5719-llvm-45810b463130453c9e84a8fad213106c75cb71cb.tar.gz
bcm5719-llvm-45810b463130453c9e84a8fad213106c75cb71cb.zip
Clarify the code in checkDLLAttribute()
Update the comments to make it more clear what's going on, and address Richard's comments from PR21718. This doesn't fix that bug, but hopefully makes the code easier to understand. llvm-svn: 224303
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 82407250657..ec87b850ba7 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4748,7 +4748,7 @@ static void checkDLLAttribute(Sema &S, CXXRecordDecl *Class) {
if (MD && ClassExported) {
if (MD->isUserProvided()) {
- // Instantiate non-default methods..
+ // Instantiate non-default class member functions ...
// .. except for certain kinds of template specializations.
if (TSK == TSK_ExplicitInstantiationDeclaration)
@@ -4757,16 +4757,21 @@ static void checkDLLAttribute(Sema &S, CXXRecordDecl *Class) {
continue;
S.MarkFunctionReferenced(Class->getLocation(), MD);
+
+ // The function will be passed to the consumer when its definition is
+ // encountered.
} else if (!MD->isTrivial() || MD->isExplicitlyDefaulted() ||
MD->isCopyAssignmentOperator() ||
MD->isMoveAssignmentOperator()) {
- // Instantiate non-trivial or explicitly defaulted methods, and the
- // copy assignment / move assignment operators.
+ // Synthesize and instantiate non-trivial implicit methods, explicitly
+ // defaulted methods, and the copy and move assignment operators. The
+ // latter are exported even if they are trivial, because the address of
+ // an operator can be taken and should compare equal accross libraries.
S.MarkFunctionReferenced(Class->getLocation(), MD);
- // Resolve its exception specification; CodeGen needs it.
- auto *FPT = MD->getType()->getAs<FunctionProtoType>();
- S.ResolveExceptionSpec(Class->getLocation(), FPT);
- S.ActOnFinishInlineMethodDef(MD);
+
+ // There is no later point when we will see the definition of this
+ // function, so pass it to the consumer now.
+ S.Consumer.HandleTopLevelDecl(DeclGroupRef(MD));
}
}
}
OpenPOWER on IntegriCloud