-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang-cl] Fix value of __FUNCTION__ in MSVC mode. #84014
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
Changes from all commits
bdefe75
13f4693
5eeffd1
16d3c75
463cbc9
4b42f76
878b179
bdcb510
efeb7b0
9f16b25
09b04af
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 |
---|---|---|
|
@@ -1635,6 +1635,17 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T, | |
if (T->getKeyword() != ElaboratedTypeKeyword::None) | ||
OS << " "; | ||
NestedNameSpecifier *Qualifier = T->getQualifier(); | ||
if (!Policy.SuppressTagKeyword && Policy.SuppressScope && | ||
!Policy.SuppressUnwrittenScope) { | ||
bool OldTagKeyword = Policy.SuppressTagKeyword; | ||
bool OldSupressScope = Policy.SuppressScope; | ||
Policy.SuppressTagKeyword = true; | ||
Policy.SuppressScope = false; | ||
Comment on lines
+1642
to
+1643
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. Don't we want to reset these once we're done with the call to 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. Yes, I think so. 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. Hmmm, your changes don't look quite right to me. The I think you wanted something more like:
Before making the changes, I think you should also add test coverage to the unit test where these changes will fix the test. 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. Not sure what you mean here "where these changes will fix the test"? will fix which test? The unit test you are referring to is 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 code was broken but no tests failed, then the fix you made was also broken but still no tests failed. So I'm asking you to write a new test that demonstrates incorrect behavior related to failing to reset the printing policy after modifying it, then fix the code until that test shows the correct behavior. 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. Hmmm! Can't seem to find a test case that fails. At each step of the printing 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. You need to reset the values here, or use a separate |
||
printBefore(T->getNamedType(), OS); | ||
Policy.SuppressTagKeyword = OldTagKeyword; | ||
Policy.SuppressScope = OldSupressScope; | ||
return; | ||
} | ||
if (Qualifier) | ||
Qualifier->print(OS, Policy); | ||
} | ||
|
@@ -2260,10 +2271,15 @@ 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.SuppressTagKeyword && | ||
Argument.getKind() == TemplateArgument::Type && | ||
isa<TagType>(Argument.getAsType())) | ||
OS << Argument.getAsType().getAsString(); | ||
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.