[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 5 08:03:24 PST 2024
================
@@ -721,10 +722,17 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
return std::string(Out.str());
}
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurrentDecl)) {
- if (IK != PredefinedIdentKind::PrettyFunction &&
- IK != PredefinedIdentKind::PrettyFunctionNoVirtual &&
- IK != PredefinedIdentKind::FuncSig &&
- IK != PredefinedIdentKind::LFuncSig)
+ const auto &LO = Context.getLangOpts();
+ if ((ForceElaboratedPrinting &&
+ (((IK == PredefinedIdentKind::Func ||
+ IK == PredefinedIdentKind ::Function) &&
+ !LO.MicrosoftExt) ||
+ (IK == PredefinedIdentKind::LFunction && LO.MicrosoftExt))) ||
+ (!ForceElaboratedPrinting &&
+ (IK != PredefinedIdentKind::PrettyFunction &&
+ IK != PredefinedIdentKind::PrettyFunctionNoVirtual &&
+ IK != PredefinedIdentKind::FuncSig &&
+ IK != PredefinedIdentKind::LFuncSig)))
----------------
Sirraide wrote:
Also, afaik you’re supposed to use `MSVCCompat`, not `MicrosoftExt` to check if we’re in ‘MSVC mode’, if you will. This isn’t really an ‘extension’ that would otherwise be disabled, so I don’t think `MicrosoftExt` is the right thing here.
https://github.com/llvm/llvm-project/pull/84014
More information about the cfe-commits
mailing list