[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 07:37:25 PDT 2024


================
@@ -855,7 +868,17 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
         Out << Proto << " -> ";
         Proto.clear();
       }
-      AFT->getReturnType().print(Out, Policy, Proto);
+      if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
+          !Policy.SuppressUnwrittenScope) {
+        AddPrefix(Policy, AFT->getReturnType(), Out);
+        bool OldTagKeyword = Policy.SuppressTagKeyword;
+        bool OldSupressScope = Policy.SuppressScope;
+        AFT->getReturnType().print(Out, Policy, Proto);
+        Policy.SuppressTagKeyword = OldTagKeyword;
+        Policy.SuppressScope = OldSupressScope;
----------------
AaronBallman wrote:

This is only necessary because of the changes you made in TypePrinter.cpp, right? e.g., if we reset the policy back to its original values there, we don't need to do it here.

https://github.com/llvm/llvm-project/pull/84014


More information about the cfe-commits mailing list