-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[clang-cl] Fix value of __FUNCTION__ in MSVC mode. #67592
base: main
Are you sure you want to change the base?
Changes from 14 commits
8511b32
0e9a102
2d98d76
7ac03e8
f28c4b4
756166e
b8e0f3e
924ad19
dfec4ef
b873847
3034632
18d2ff4
dbf3d77
765a5d6
6ecd261
5bafb8d
3fc277f
e59681d
f651f13
f15d799
b0181be
a038f97
06bd74b
601a958
2b4d67b
b92c3fe
92fe6c6
8fa3301
6e293c0
8f65e7b
18d0d9b
64216ba
68516bf
0813b90
f6f79d4
53f89a0
b542501
ae58b67
3337d69
ce95a56
df0fd3a
e741d88
84927a6
dd426fa
3a30d8e
137ed17
2ab6d1e
00570c3
af00945
4a3f7e7
582718f
1e8d3c3
fcdf818
09ffd33
6fe60bd
a490bbf
1a0c988
1685e7f
7b0b64a
214f897
ebaf26d
617398e
76ce3c1
d01576b
ec415af
ae76dfb
2fb764d
f7a15e0
7a2d934
4762c65
24aec16
c21ef15
f31ac3c
17ede03
8f14149
bcc6ca7
8f80d46
a56ef9f
081e202
e8a9aa2
1c530b3
147f54e
69b8372
21c83fe
189d89a
8bcb1ce
ed0aa34
f4215f7
2445a96
ecd7fce
70467dd
5594d12
39b67c0
864593b
164c098
e09e956
463fb9f
cb807ff
057e725
06ac828
73dfc7b
a2e7827
07317bb
aab3d13
e4b15fc
fb67dce
28b354a
597f976
b14220e
c4f5993
bf08d02
10f5e98
ca827d5
2a95fe4
1f613bc
57f599d
a30ba2c
b901b0d
dfb8a15
f25debe
d89b771
af83a2a
da591d3
8ec28af
051e910
60fbd60
f505a92
205dce6
ea628e3
0ec318e
def16bc
8b26e60
4dd9c2e
8fccf6b
d5f77e1
6594f42
6b70c5d
6c6ea9d
e52650c
1a4f52c
e29cad6
5f70f25
67221ed
c462160
37293e6
3f18f6a
800de14
eb3b063
22f34ea
a5d3a1d
732a5cb
5b4759f
58b44c8
3ca73e0
03f150b
5f05839
0c89427
5535716
0c90e88
33de5a3
09b34b9
5105f15
2435dcd
3dd6750
b29301c
5f058aa
8d1046a
61c283d
9606655
2b5cd8b
ff72c83
938ddbf
ccc48d4
b0c158b
e6e53ca
2c5d01c
8300f30
aa6ebf9
23bc5b6
43222bd
354deba
a282109
3a146d5
8715f25
63725ab
c7fdd8c
3d14e85
a015f59
408d4e1
96b2c3b
7af4e8b
db76af2
da5966e
aaf5c81
71c2a13
310a278
c6565f2
5dc9e87
ded5de1
f7d4236
982e902
cad6ad2
540d255
ecc3bda
67d5ba9
5c54f72
eaf0d82
8f30b62
00e4a41
7d55a3b
c089fa5
e4882d8
906580b
6b62a91
6e36ceb
530f0e6
46d7876
d9ae4a6
27ce512
b3c2c5a
1e429ff
c1d8d0a
bbeb946
52a460f
07f8efa
c54064d
f407f2d
13a78fd
8982786
d052148
f513c6f
2e0dc54
f5ef478
994ba97
a731882
29bd183
1526dbc
ddf0567
d63d336
f09a0c4
4729fd7
90d7864
330114e
96615d7
0a7c176
31e9bd6
fd278a0
d499a57
b296128
e6b1822
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,7 +726,8 @@ StringRef PredefinedExpr::getIdentKindName(PredefinedExpr::IdentKind IK) { | |
|
||
// FIXME: Maybe this should use DeclPrinter with a special "print predefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The more complex we make this, the more I think this FIXME sounds like a somewhat better idea though it would potentially be an involved refactoring... |
||
// expr" policy instead. | ||
std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl) { | ||
std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl, | ||
bool ForceElaboratedPrinting) { | ||
ASTContext &Context = CurrentDecl->getASTContext(); | ||
|
||
if (IK == PredefinedExpr::FuncDName) { | ||
|
@@ -774,9 +775,17 @@ std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl) { | |
return std::string(Out.str()); | ||
} | ||
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurrentDecl)) { | ||
if (IK != PrettyFunction && IK != PrettyFunctionNoVirtual && | ||
IK != FuncSig && IK != LFuncSig) | ||
return FD->getNameAsString(); | ||
const auto &LO = Context.getLangOpts(); | ||
if (ForceElaboratedPrinting) { | ||
if ((IK == Func || IK == Function) && !LO.MicrosoftExt) | ||
return FD->getNameAsString(); | ||
if (IK == LFunction && LO.MicrosoftExt) | ||
return FD->getNameAsString(); | ||
} else { | ||
if (IK != PrettyFunction && IK != PrettyFunctionNoVirtual && | ||
IK != FuncSig && IK != LFuncSig) | ||
return FD->getNameAsString(); | ||
} | ||
|
||
SmallString<256> Name; | ||
llvm::raw_svector_ostream Out(Name); | ||
|
@@ -803,6 +812,8 @@ std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl) { | |
PrintingPolicy Policy(Context.getLangOpts()); | ||
PrettyCallbacks PrettyCB(Context.getLangOpts()); | ||
Policy.Callbacks = &PrettyCB; | ||
if (IK == Function && ForceElaboratedPrinting) | ||
Policy.ForcePrintingAsElaboratedType = LO.MicrosoftExt; | ||
std::string Proto; | ||
llvm::raw_string_ostream POut(Proto); | ||
|
||
|
@@ -829,6 +840,12 @@ std::string PredefinedExpr::ComputeName(IdentKind IK, const Decl *CurrentDecl) { | |
|
||
FD->printQualifiedName(POut, Policy); | ||
|
||
if (IK == Function) { | ||
POut.flush(); | ||
Out << Proto; | ||
return std::string(Name); | ||
} | ||
|
||
POut << "("; | ||
if (FT) { | ||
for (unsigned i = 0, e = Decl->getNumParams(); i != e; ++i) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2195,6 +2195,7 @@ printTo(raw_ostream &OS, ArrayRef<TA> Args, const PrintingPolicy &Policy, | |
llvm::SmallVector<TemplateArgument, 8> OrigArgs; | ||
for (const TA &A : Args) | ||
OrigArgs.push_back(getArgument(A)); | ||
|
||
while (!Args.empty() && getArgument(Args.back()).getIsDefaulted()) | ||
Args = Args.drop_back(); | ||
} | ||
|
@@ -2218,10 +2219,16 @@ printTo(raw_ostream &OS, ArrayRef<TA> Args, const PrintingPolicy &Policy, | |
} else { | ||
if (!FirstArg) | ||
OS << Comma; | ||
// Tries to print the argument with location info if exists. | ||
printArgument(Arg, Policy, ArgOS, | ||
TemplateParameterList::shouldIncludeTypeForArgument( | ||
Policy, TPL, ParmIndex)); | ||
|
||
if (Policy.ForcePrintingAsElaboratedType && | ||
Argument.getKind() == TemplateArgument::Type && | ||
!Argument.getAsType()->isBuiltinType()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be looking at |
||
OS << Argument.getAsType().getAsString().data(); | ||
else | ||
// Tries to print the argument with location info if exists. | ||
printArgument(Arg, Policy, ArgOS, | ||
TemplateParameterList::shouldIncludeTypeForArgument( | ||
Policy, TPL, ParmIndex)); | ||
} | ||
StringRef ArgString = ArgOS.str(); | ||
|
||
|
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's not clear to me how this new option should interact with
SuppressElaboration
andSuppressTagKeyword
or whether we should have it at all. I would have expected that the existing type printing options (likeFullyQualifiedName
) would be sufficient and that we were failing to honor those in template arguments?