forked from OSchip/llvm-project
[clang] consistently use getLangOpts()
File was inconsistent.
This commit is contained in:
parent
8d65504223
commit
663f4f7edc
|
@ -345,7 +345,7 @@ void Preprocessor::RegisterBuiltinMacros() {
|
||||||
Ident_Pragma = RegisterBuiltinMacro(*this, "_Pragma");
|
Ident_Pragma = RegisterBuiltinMacro(*this, "_Pragma");
|
||||||
|
|
||||||
// C++ Standing Document Extensions.
|
// C++ Standing Document Extensions.
|
||||||
if (LangOpts.CPlusPlus)
|
if (getLangOpts().CPlusPlus)
|
||||||
Ident__has_cpp_attribute =
|
Ident__has_cpp_attribute =
|
||||||
RegisterBuiltinMacro(*this, "__has_cpp_attribute");
|
RegisterBuiltinMacro(*this, "__has_cpp_attribute");
|
||||||
else
|
else
|
||||||
|
@ -357,7 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() {
|
||||||
Ident__TIMESTAMP__ = RegisterBuiltinMacro(*this, "__TIMESTAMP__");
|
Ident__TIMESTAMP__ = RegisterBuiltinMacro(*this, "__TIMESTAMP__");
|
||||||
|
|
||||||
// Microsoft Extensions.
|
// Microsoft Extensions.
|
||||||
if (LangOpts.MicrosoftExt) {
|
if (getLangOpts().MicrosoftExt) {
|
||||||
Ident__identifier = RegisterBuiltinMacro(*this, "__identifier");
|
Ident__identifier = RegisterBuiltinMacro(*this, "__identifier");
|
||||||
Ident__pragma = RegisterBuiltinMacro(*this, "__pragma");
|
Ident__pragma = RegisterBuiltinMacro(*this, "__pragma");
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +371,7 @@ void Preprocessor::RegisterBuiltinMacros() {
|
||||||
Ident__has_extension = RegisterBuiltinMacro(*this, "__has_extension");
|
Ident__has_extension = RegisterBuiltinMacro(*this, "__has_extension");
|
||||||
Ident__has_builtin = RegisterBuiltinMacro(*this, "__has_builtin");
|
Ident__has_builtin = RegisterBuiltinMacro(*this, "__has_builtin");
|
||||||
Ident__has_attribute = RegisterBuiltinMacro(*this, "__has_attribute");
|
Ident__has_attribute = RegisterBuiltinMacro(*this, "__has_attribute");
|
||||||
if (!LangOpts.CPlusPlus)
|
if (!getLangOpts().CPlusPlus)
|
||||||
Ident__has_c_attribute = RegisterBuiltinMacro(*this, "__has_c_attribute");
|
Ident__has_c_attribute = RegisterBuiltinMacro(*this, "__has_c_attribute");
|
||||||
else
|
else
|
||||||
Ident__has_c_attribute = nullptr;
|
Ident__has_c_attribute = nullptr;
|
||||||
|
@ -389,7 +389,7 @@ void Preprocessor::RegisterBuiltinMacros() {
|
||||||
|
|
||||||
// Modules.
|
// Modules.
|
||||||
Ident__building_module = RegisterBuiltinMacro(*this, "__building_module");
|
Ident__building_module = RegisterBuiltinMacro(*this, "__building_module");
|
||||||
if (!LangOpts.CurrentModule.empty())
|
if (!getLangOpts().CurrentModule.empty())
|
||||||
Ident__MODULE__ = RegisterBuiltinMacro(*this, "__MODULE__");
|
Ident__MODULE__ = RegisterBuiltinMacro(*this, "__MODULE__");
|
||||||
else
|
else
|
||||||
Ident__MODULE__ = nullptr;
|
Ident__MODULE__ = nullptr;
|
||||||
|
@ -889,10 +889,10 @@ MacroArgs *Preprocessor::ReadMacroCallArgumentList(Token &MacroName,
|
||||||
|
|
||||||
// Empty arguments are standard in C99 and C++0x, and are supported as an
|
// Empty arguments are standard in C99 and C++0x, and are supported as an
|
||||||
// extension in other modes.
|
// extension in other modes.
|
||||||
if (ArgTokens.size() == ArgTokenStart && !LangOpts.C99)
|
if (ArgTokens.size() == ArgTokenStart && !getLangOpts().C99)
|
||||||
Diag(Tok, LangOpts.CPlusPlus11 ?
|
Diag(Tok, getLangOpts().CPlusPlus11
|
||||||
diag::warn_cxx98_compat_empty_fnmacro_arg :
|
? diag::warn_cxx98_compat_empty_fnmacro_arg
|
||||||
diag::ext_empty_fnmacro_arg);
|
: diag::ext_empty_fnmacro_arg);
|
||||||
|
|
||||||
// Add a marker EOF token to the end of the token list for this argument.
|
// Add a marker EOF token to the end of the token list for this argument.
|
||||||
Token EOFTok;
|
Token EOFTok;
|
||||||
|
@ -1628,7 +1628,6 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
|
||||||
[this](Token &Tok, bool &HasLexedNextToken) -> int {
|
[this](Token &Tok, bool &HasLexedNextToken) -> int {
|
||||||
IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
|
IdentifierInfo *II = ExpectFeatureIdentifierInfo(Tok, *this,
|
||||||
diag::err_feature_check_malformed);
|
diag::err_feature_check_malformed);
|
||||||
const LangOptions &LangOpts = getLangOpts();
|
|
||||||
if (!II)
|
if (!II)
|
||||||
return false;
|
return false;
|
||||||
else if (II->getBuiltinID() != 0) {
|
else if (II->getBuiltinID() != 0) {
|
||||||
|
@ -1664,8 +1663,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
|
||||||
} else {
|
} else {
|
||||||
return llvm::StringSwitch<bool>(II->getName())
|
return llvm::StringSwitch<bool>(II->getName())
|
||||||
// Report builtin templates as being builtins.
|
// Report builtin templates as being builtins.
|
||||||
.Case("__make_integer_seq", LangOpts.CPlusPlus)
|
.Case("__make_integer_seq", getLangOpts().CPlusPlus)
|
||||||
.Case("__type_pack_element", LangOpts.CPlusPlus)
|
.Case("__type_pack_element", getLangOpts().CPlusPlus)
|
||||||
// Likewise for some builtin preprocessor macros.
|
// Likewise for some builtin preprocessor macros.
|
||||||
// FIXME: This is inconsistent; we usually suggest detecting
|
// FIXME: This is inconsistent; we usually suggest detecting
|
||||||
// builtin macros via #ifdef. Don't add more cases here.
|
// builtin macros via #ifdef. Don't add more cases here.
|
||||||
|
|
Loading…
Reference in New Issue