forked from OSchip/llvm-project
Return false from __has_declspec_attribute() if not explicitly enabled
Currently, projects can check for __has_declspec_attribute() and use it accordingly, but the check for __has_declspec_attribute will return true even if declspec attributes are not enabled for the target. This changes Clang to instead return false when declspec attributes are not supported for the target.
This commit is contained in:
parent
b117d17d26
commit
ef3800e821
|
@ -1693,8 +1693,14 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
|
|||
[this](Token &Tok, bool &HasLexedNextToken) -> int {
|
||||
IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
|
||||
diag::err_feature_check_malformed);
|
||||
return II ? hasAttribute(AttrSyntax::Declspec, nullptr, II,
|
||||
getTargetInfo(), getLangOpts()) : 0;
|
||||
if (II) {
|
||||
const LangOptions &LangOpts = getLangOpts();
|
||||
return LangOpts.DeclSpecKeyword &&
|
||||
hasAttribute(AttrSyntax::Declspec, nullptr, II,
|
||||
getTargetInfo(), LangOpts);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
} else if (II == Ident__has_cpp_attribute ||
|
||||
II == Ident__has_c_attribute) {
|
||||
|
|
Loading…
Reference in New Issue