diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-03-08 10:28:52 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-03-08 10:28:52 +0000 |
commit | 8536392a830e3500b313fe879af3e91b505d7ddc (patch) | |
tree | 56e20996c906b4fca83b934a98ad6f2ad7b8d89a /llvm/lib/Support/RandomNumberGenerator.cpp | |
parent | 1ab4adb1d3355e8bbd14fb90d320efa8606a7764 (diff) | |
download | llvm-8536392a830e3500b313fe879af3e91b505d7ddc.zip llvm-8536392a830e3500b313fe879af3e91b505d7ddc.tar.gz llvm-8536392a830e3500b313fe879af3e91b505d7ddc.tar.bz2 |
Sema: Methods in unavailable classes are unavailable
Similar to the template cases in r262050, when a C++ method in an
unavailable struct/class calls unavailable API, don't diagnose an error.
I.e., this case was failing:
void foo() __attribute__((unavailable));
struct __attribute__((unavailable)) A {
void bar() { foo(); }
};
Since A is unavailable, A::bar is allowed to call foo. However, we were
emitting a diagnostic here. This commit checks up the context chain
from A::bar, in a manner inspired by SemaDeclAttr.cpp:isDeclUnavailable.
I expected to find other related issues but failed to trigger them:
- I wondered if DeclBase::getAvailability should check for
`TemplateDecl` instead of `FunctionTemplateDecl`, but I couldn't find
a way to trigger this. I left behind a few extra tests to make sure
we don't regress.
- I wondered if Sema::isFunctionConsideredUnavailable should be
symmetric, checking up the context chain of the callee (this commit
only checks up the context chain of the caller). However, I couldn't
think of a testcase that didn't require first referencing the
unavailable type; this, we already diagnose.
rdar://problem/25030656
llvm-svn: 262921
Diffstat (limited to 'llvm/lib/Support/RandomNumberGenerator.cpp')
0 files changed, 0 insertions, 0 deletions