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

2024-03-01 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/20] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-29 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: > > struct struct X > > Interesting! The LIT test is passing on a debug build on Windows and > generating the right output: > > `VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)` > > I will try a release build. It looks like I can reproduce it with the release bu

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

2024-02-29 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: > struct struct X Interesting! The LIT test is passing on a debug build on Windows and generating the right output: `VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)` I will try a release build. https://github.com/llvm/llvm-project/pull/67592 __

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

2024-02-29 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The failure found by CI looks to be related: ``` :422:1: note: possible intended match here VarDecl:{ResultType struct struct X}{TypedText f1} (50) (deprecated) ``` (note the `struct struct`). https://github.com/llvm/llvm-project/pull/67592

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

2024-02-29 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/19] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-27 Thread Aaron Ballman via cfe-commits
@@ -2260,10 +2269,15 @@ printTo(raw_ostream &OS, ArrayRef Args, const PrintingPolicy &Policy, } else { if (!FirstArg) OS << Comma; - // Tries to print the argument with location info if exists. - printArgument(Arg, Policy, ArgOS, -

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

2024-02-27 Thread Aaron Ballman via cfe-commits
@@ -1635,6 +1635,15 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T, if (T->getKeyword() != ElaboratedTypeKeyword::None) OS << " "; NestedNameSpecifier *Qualifier = T->getQualifier(); +if (Policy.SuppressTagKeyword && Policy.SuppressScope)

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

2024-02-27 Thread Aaron Ballman via cfe-commits
@@ -713,11 +714,21 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK, return std::string(Out.str()); } if (const FunctionDecl *FD = dyn_cast(CurrentDecl)) { -if (IK != PredefinedIdentKind::PrettyFunction && -IK != PredefinedIdentKind::Pretty

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

2024-02-27 Thread Aaron Ballman via cfe-commits
@@ -665,7 +665,8 @@ StringRef PredefinedExpr::getIdentKindName(PredefinedIdentKind IK) { // FIXME: Maybe this should use DeclPrinter with a special "print predefined AaronBallman wrote: The more complex we make this, the more I think this FIXME sounds like a s

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

2024-02-27 Thread Aaron Ballman via cfe-commits
@@ -3740,7 +3740,11 @@ ExprResult Sema::BuildPredefinedExpr(SourceLocation Loc, else { // Pre-defined identifiers are of type char[x], where x is the length of // the string. -auto Str = PredefinedExpr::ComputeName(IK, currentDecl); +bool ForceElaboratedPrinti

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

2024-02-27 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: > @AaronBallman I removed the field that I added in the policy and tried to use > the existing ones. That broke a few LIT tests but before fixing them I want > to check with you if the combination of policy I have added in the unittest > is correct. Thanks. ping? https://gith

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

2024-02-21 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: @AaronBallman I removed the field that I added in the policy and tried to use the existing ones. That broke a few LIT tests but before fixing them I want to check with you if the combination of policy I have added in the unittest is correct. Thanks. https://github.com/llvm/ll

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

2024-02-21 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/18] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-16 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/17] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Precommit CI has relevant failures. https://github.com/llvm/llvm-project/pull/67592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-02-16 Thread Aaron Ballman via cfe-commits
@@ -1635,6 +1635,14 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T, if (T->getKeyword() != ElaboratedTypeKeyword::None) OS << " "; NestedNameSpecifier *Qualifier = T->getQualifier(); +if (Policy.FullyQualifiedName) { Aaron

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

2024-02-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/67592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-02-15 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/16] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-15 Thread Aaron Ballman via cfe-commits
@@ -326,6 +326,10 @@ struct PrintingPolicy { LLVM_PREFERRED_TYPE(bool) unsigned AlwaysIncludeTypeForTemplateArgument : 1; + // Whether to print the type as an elaborated type. This is used when + // printing a function via the _FUNCTION__ macro in MSVC mode. + unsigned

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

2024-02-15 Thread Aaron Ballman via cfe-commits
@@ -897,7 +897,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { D->getBody()->printPrettyControlled(Out, nullptr, SubPolicy, Indentation, "\n", &Context); } else { - if (!Policy.TerseOutput && isa(*D)) + if (Po

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

2024-02-15 Thread Aaron Ballman via cfe-commits
@@ -1635,6 +1635,13 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T, if (T->getKeyword() != ElaboratedTypeKeyword::None) OS << " "; NestedNameSpecifier *Qualifier = T->getQualifier(); +if (Policy.ForcePrintingAsElaboratedType) { + if (

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

2024-02-15 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff d1f510cca8e966bd1742bf17256bfec99dcdf229 09c7dd2f5973a36448dd7ea17664f13c28aa --

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

2024-02-15 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/15] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-13 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/14] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-13 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/13] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-13 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/12] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2024-02-13 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/11] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

[clang-tools-extra] [llvm] [flang] [compiler-rt] [clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #67592)

2024-01-03 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam closed https://github.com/llvm/llvm-project/pull/67592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2023-10-05 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: We have unit tests for these that live at: https://github.com/llvm/llvm-project/blob/32d16b64d3125e76f65d7d88a302a33618eb0e6e/clang/unittests/AST/TypePrinterTest.cpp and https://github.com/llvm/llvm-project/blob/32d16b64d3125e76f65d7d88a302a33618eb0e6e/clang/unittests/AST/D

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

2023-10-05 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman By pretty printed you mean the use of **PRETTY_FUNCTION** right? No, I mean using the `DeclPrinter` and `TypePrinter` interfaces that are used to implement `-ast-print`: https://github.com/llvm/llvm-project/blob/32d16b64d3125e76f65d7d88a302a33618eb0e6e/clang/

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

2023-10-05 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: > struct S { int x; }; > namespace NS { > class C {}; > } > > S foo(S s1, NS::C c1) { > S s12{12}; > using namespace NS; > C c; > } @AaronBallman By pretty printed you mean the use of __PRETTY_FUNCTION__ right? In MSVC this macro is not defined. The equivalent one is FUNCS

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

2023-10-04 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: I'd appreciate some unit tests showing that we print the elaboration in other circumstances. e.g., ``` struct S { int x; }; namespace NS { class C {}; } S foo(S s1, NS::C c1) { S s12{12}; using namespace NS; C c; } ``` ensuring that we pretty pri

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

2023-10-04 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 01/11] Fix value of __FUNCTION__ and __func__ in MSVC mode. ---

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

2023-10-02 Thread Aaron Ballman via cfe-commits
@@ -463,8 +470,73 @@ void ctor_tests() { constexpr SL global_sl = SL::current(); static_assert(is_equal(global_sl.function(), "")); +template +class TestBI { +public: + TestBI() { +#ifdef MS + static_assert(is_equal(__FUNCTION__, "test_func::TestBI::TestBI")); + s

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

2023-10-02 Thread Aaron Ballman via cfe-commits
@@ -2218,6 +2219,24 @@ printTo(raw_ostream &OS, ArrayRef Args, const PrintingPolicy &Policy, } else { if (!FirstArg) OS << Comma; + + if (Policy.UseClassForTemplateArgument && + Argument.getKind() == TemplateArgument::Type && + !Argumen

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

2023-10-02 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/67592 >From 55b67a58ef8b9856e5f0a8f535b8617f59711dec Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 27 Sep 2023 11:59:04 -0700 Subject: [PATCH 1/7] Fix value of __FUNCTION__ and __func__ in MSVC mode. --- cl

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

2023-09-30 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam edited https://github.com/llvm/llvm-project/pull/67592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits