[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 11:48:40 PDT 2024


================
@@ -855,7 +865,14 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
         Out << Proto << " -> ";
         Proto.clear();
       }
-      AFT->getReturnType().print(Out, Policy, Proto);
+      if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
+          !Policy.SuppressUnwrittenScope) {
+        MaybePrintTagKeywordIfSupressingScopes(Policy, AFT->getReturnType(),
+                                               Out);
+        AFT->getReturnType().print(Out, Policy, Proto);
+      } else {
+        AFT->getReturnType().print(Out, Policy, Proto);
+      }
----------------
AaronBallman wrote:

```suggestion
      if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
          !Policy.SuppressUnwrittenScope)
        MaybePrintTagKeywordIfSupressingScopes(Policy, AFT->getReturnType(),
                                               Out);
      AFT->getReturnType().print(Out, Policy, Proto);
```

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


More information about the cfe-commits mailing list