-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #45: Implement is_noexcept meta function #56
base: p2996
Are you sure you want to change the base?
Conversation
move instantiated func templates into supported section
clang/lib/Sema/Metafunctions.cpp
Outdated
@@ -1006,6 +1011,37 @@ bool isAccessible(Sema &S, DeclContext *AccessDC, NamedDecl *D) { | |||
return Result; | |||
} | |||
|
|||
template <typename T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a template? Seems like T
will always be CXXMethodDecl
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is CXXMethodDecl only in the "T->isRecordType()" branch. For "T->isFunctionPrototype()" it is FunctionProtoType.
I guess I could try extracting FunctionProtoType from CXXMethodDecl and make this function non-template. Would that be better if that's possible to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh I see, sorry about that. How about we just take the ExceptionSpecificationType
, and inline this as a lambda in the isFunctionOrLambdaNoexcept
function?
static bool isFunctionOrLambdaNoexcept(const QualType QT) {
static auto isExceptionSpecNoexcept = [](ExceptionSpecificationType) {
switch (...) // ...
}
if (auto *FPT = dyn_cast<FunctionProtoType>(QT)) {
return isExceptionSpecNoexcept(FPT->getExceptionSpecType());
} else if (auto *RT = dyn_cast<RecordType>(QT)) {
auto *RDecl = cast<CXXRecordDecl>(RT->getDecl());
if (RDecl->isLambda() && !RDecl->isGenericLambda())
return isExceptionSpecNoexcept(
RDecl->getLambdaCallOperator()->getExceptionSpecType());
}
return false;
}
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done
libcxx/test/std/experimental/reflection/member-classification.pass.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel M. Katz <katzdm@gmail.com>
…plate function make switch ident follow the style of this file
Issue number of the reported bug or feature request: #45
Describe your changes
Added is_noexcept as per P2996r3 spec.
The function checks for noexcept on:
For everything else it returns false.
Testing performed
Tests added to libcxx to cover all supported scenarios.