aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaInit.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-04-05[Clang][NFC] Refactor "Designators" to be more similarBill Wendling1-28/+16
This makes the two interfaces for designators more similar so that it's easier to merge them together in a future refactoring. Differential Revision: https://reviews.llvm.org/D147580
2023-04-03[C2x] Implement support for empty brace initialization (WG14 N2900 and WG14 ↵Aaron Ballman1-18/+34
N3011) This implements support for allowing {} to consistently zero initialize objects. We already supported most of this work as a GNU extension, but the C2x feature goes beyond what the GNU extension allowed. The changes in this patch are: * Removed the -Wgnu-empty-initializer warning group. The extension is now a C2x extension warning instead. Note that use of `-Wno-gnu-empty-initializer seems` to be quite low in the wild (https://sourcegraph.com/search?q=context%3Aglobal+-file%3A.*test.*+%22-Wno-gnu-empty-initializer%22&patternType=standard&sm=1&groupBy=repo which currently only gives 8 hits total), so this is not expected to be an overly disruptive change. But I'm adding the clang vendors review group just in case this expectation is wrong. * Reworded the diagnostic wording to be about a C2x extension, added a pre-C2x compat warning. * Allow {} to zero initialize a VLA This functionality is exposed as an extension in all older C modes (same as the GNU extension was), but does *not* allow the extension for VLA initialization in C++ due to concern about handling non-trivially constructible types. Differential Revision: https://reviews.llvm.org/D147349
2023-03-30[clang] Fix 2 bugs with parenthesized aggregate initializationAlan Zhao1-0/+2
* Fix an issue where temporaries initialized via parenthesized aggregate initialization don't get destroyed. * Fix an issue where aggregate initialization omits calls to class members' move constructors after a TreeTransform. This occurs because the CXXConstructExpr wrapping the call to the move constructor gets unboxed during a TreeTransform of the wrapping FunctionalCastExpr (as with a InitListExpr), but unlike InitListExpr, we dont reperform the InitializationSequence for the list's expressions to regenerate the CXXConstructExpr. This patch fixes this bug by treating CXXParenListInitExpr identically to InitListExpr in this regard. Fixes #61145 Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D146465
2023-03-23Fix highlighting issue with _complex and initialization list with more than ↵NagaChaitanya Vellanki1-1/+1
2 items Fixes https://github.com/llvm/llvm-project/issues/61518 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D146503
2023-03-21[clang][NFC] Fix typo in commentIlyas Mustafazade1-1/+1
Differential Revision: https://reviews.llvm.org/D146422
2023-03-02Revert "[Clang] Refactor "Designators" into a unified implementation [NFC]"Bill Wendling1-24/+39
This reverts commit 3c07db5f58e9852f35202f0fffed50fc7506f37b. This caused https://github.com/llvm/llvm-project/issues/61118. Reverting to ensure this is a pure NFC change.
2023-02-07[Clang] Refactor "Designators" into a unified implementation [NFC]Bill Wendling1-39/+24
The interfaces for designators (i.e. C99 designated initializers) was done in two slightly different ways. This was rather wasteful as the differences could be combined into one. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D140584
2023-01-19[clang] Improve diagnostic for "initializer-string for char array is too long"Evan Smal1-0/+1
This patch improves the diagnostic message "initializer-string for char array is too long" by specifying an expected array length and by indicating that the initializer string implicitly includes the null terminator. Fixes #58829 Differential Revision: https://reviews.llvm.org/D141283
2023-01-12[clang] Reland parenthesized aggregate init patchesAlan Zhao1-11/+282
This commit relands the patches for implementing P0960R3 and P1975R0, which describe initializing aggregates via a parenthesized list. The relanded commits are: * 40c52159d3ee - P0960R3 and P1975R0: Allow initializing aggregates from a parenthesized list of values * c77a91bb7ba7 - Remove overly restrictive aggregate paren init logic * 32d7aae04fdb - Fix a clang crash on invalid code in C++20 mode This patch also fixes a crash in the original implementation. Previously, if the input tried to call an implicitly deleted copy or move constructor of a union, we would then try to initialize the union by initializing it's first element with a reference to a union. This behavior is incorrect (we should fail to initialize) and if the type of the first element has a constructor with a single template typename parameter, then Clang will explode. This patch fixes that issue by checking that constructor overload resolution did not result in a deleted function before attempting parenthesized aggregate initialization. Additionally, this patch also includes D140159, which contains some minor fixes made in response to code review comments in the original implementation that were made after that patch was submitted. Co-authored-by: Sheng <ox59616e@gmail.com> Fixes #54040, Fixes #59675 Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D141546
2023-01-09Move from llvm::makeArrayRef to ArrayRef deduction guides - clang/ partserge-sans-paille1-2/+2
This is a follow-up to https://reviews.llvm.org/D140896, split into several parts as it touches a lot of files. Differential Revision: https://reviews.llvm.org/D141139
2023-01-04[clang] Revert parentesized aggregate initalization patchesAlan Zhao1-258/+11
This feature causes clang to crash when compiling Chrome - see https://crbug.com/1405031 and https://github.com/llvm/llvm-project/issues/59675 Revert "[clang] Fix a clang crash on invalid code in C++20 mode." This reverts commit 32d7aae04fdb58e65a952f281ff2f2c3f396d98f. Revert "[clang] Remove overly restrictive aggregate paren init logic" This reverts commit c77a91bb7ba793ec3a6a5da3743ed55056291658. Revert "[clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a parenthesized list of values" This reverts commit 40c52159d3ee337dbed14e4c73b5616ea354c337.
2022-12-31[clang][NFC] Fix warning due to initializing a pointer with `false`Markus Böck1-1/+1
2022-12-23[clang] Fix a clang crash on invalid code in C++20 mode.Haojian Wu1-1/+5
This crash is a combination of recovery-expr + new SemaInit.cpp code introduced by by https://reviews.llvm.org/D129531. Differential Revision: https://reviews.llvm.org/D140587
2022-12-21[clang] Remove overly restrictive aggregate paren init logicAlan Zhao1-21/+1
Previously, we would only attempt to perform a parenthesized aggregate initialization if constructor initialization failed for only the default constructor, default copy constructor, and default move constructor. The original intent of this logic was to reject initializing objects that have failed resolving a user-defined constructor. However, this check is redundant because we check for isAggregate() before attempting to perform a parenthesized aggregate initialization, and classes that have user-defined or user-declared constructors are not aggregates. Furthermore, this check is too restrictive - the following valid examples fail: * Aggregate class with user-defined destructor - fails because default move constructors are not generated for classes with user-defined destructors (https://github.com/llvm/llvm-project/issues/54040#issuecomment-1356926048) * Concept-guarded conversion operator on an aggregate's member: (https://github.com/llvm/llvm-project/issues/54040#issuecomment-1356931745) The solution therefore is to remove this logic; existing tests still pass, and the previously failing examples now compile. Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D140327
2022-12-14[clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a ↵Alan Zhao1-11/+274
parenthesized list of values This patch implements P0960R3, which allows initialization of aggregates via parentheses. As an example: ``` struct S { int i, j; }; S s1(1, 1); int arr1[2](1, 2); ``` This patch also implements P1975R0, which fixes the wording of P0960R3 for single-argument parenthesized lists so that statements like the following are allowed: ``` S s2(1); S s3 = static_cast<S>(1); S s4 = (S)1; int (&&arr2)[] = static_cast<int[]>(1); int (&&arr3)[2] = static_cast<int[2]>(1); ``` This patch was originally authored by @0x59616e and completed by @ayzhao. Fixes #54040, Fixes #54041 Co-authored-by: Sheng <ox59616e@gmail.com> Full write up : https://discourse.llvm.org/t/c-20-rfc-suggestion-desired-regarding-the-implementation-of-p0960r3/63744 Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D129531
2022-12-03[Sema] Use std::nullopt instead of None (NFC)Kazu Hirata1-8/+8
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-08Fix duplicate word typos; NFCRageking81-2/+2
This revision fixes typos where there are 2 consecutive words which are duplicated. There should be no code changes in this revision (only changes to comments and docs). Do let me know if there are any undesirable changes in this revision. Thanks.
2022-11-06[clang] Use llvm::reverse (NFC)Kazu Hirata1-6/+6
2022-10-24[Clang] Implement P2513Corentin Jabot1-4/+13
Implement P2513 This change allows initializing an array of unsigned char, or char from u8 string literals. This was done both to support legacy code and for compatibility with C where char8_t will be typedef to unsigned char. This is backported to C++20 as per WG21 guidance. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D136449
2022-10-20[HLSL] Disable integer promotion to avoid int16_t being promoted to int for ↵Xiang Li1-1/+1
HLSL. short will be promoted to int in UsualUnaryConversions. Disable it for HLSL to keep int16_t as 16bit. Reviewed By: aaron.ballman, rjmccall Differential Revision: https://reviews.llvm.org/D133668
2022-09-30[Clang] Fix variant crashes from GH58028, GH57370Roy Jacobson1-4/+4
Fixes a null dereference in some diagnostic issuing code. Closes https://github.com/llvm/llvm-project/issues/57370 Closes https://github.com/llvm/llvm-project/issues/58028 Reviewed By: shafik Differential Revision: https://reviews.llvm.org/D134885
2022-09-30Revert "[Clang] Fix variant crashes from GH58028, GH57370"Roy Jacobson1-4/+4
This reverts commit 9706bb3165f5e508d5e2247ad8a3f45077df546d, some CI workers complain about the test.
2022-09-30[Clang] Fix variant crashes from GH58028, GH57370Roy Jacobson1-4/+4
Fixes a null dereference in some diagnostic issuing code. Closes https://github.com/llvm/llvm-project/issues/57370 Closes https://github.com/llvm/llvm-project/issues/58028 Reviewed By: shafik Differential Revision: https://reviews.llvm.org/D134885
2022-09-29[Clang] P1169R4: static operator()Roy Jacobson1-0/+1
Implements 'P1169R4: static operator()' from C++2b. Reviewed By: #clang-language-wg, aaron.ballman Differential Revision: https://reviews.llvm.org/D133659
2022-09-03[clang] Qualify auto in range-based for loops (NFC)Kazu Hirata1-1/+1
2022-08-19[clang] Improve diagnostics for uninitialized constexpr variablesTimm Bäder1-9/+23
Instead of complaining about default initialization, tell users that constexpr variables need to be initialized by a constant expression. Differential Revision: https://reviews.llvm.org/D131662
2022-08-08[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song1-4/+4
With C++17 there is no Clang pedantic warning or MSVC C5051. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D131346
2022-08-04[Clang][C++20] Support capturing structured bindings in lambdasCorentin Jabot1-1/+1
This completes the implementation of P1091R3 and P1381R1. This patch allow the capture of structured bindings both for C++20+ and C++17, with extension/compat warning. In addition, capturing an anonymous union member, a bitfield, or a structured binding thereof now has a better diagnostic. We only support structured bindings - as opposed to other kinds of structured statements/blocks. We still emit an error for those. In addition, support for structured bindings capture is entirely disabled in OpenMP mode as this needs more investigation - a specific diagnostic indicate the feature is not yet supported there. Note that the rest of P1091R3 (static/thread_local structured bindings) was already implemented. at the request of @shafik, i can confirm the correct behavior of lldb wit this change. Fixes https://github.com/llvm/llvm-project/issues/54300 Fixes https://github.com/llvm/llvm-project/issues/54300 Fixes https://github.com/llvm/llvm-project/issues/52720 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D122768
2022-08-03Revert "[Clang][C++20] Support capturing structured bindings in lambdas"Corentin Jabot1-1/+1
This reverts commit 44f2baa3804a62ca793f0ff3e43aa71cea91a795. Breaks self builds and seems to have conformance issues.
2022-08-03[Clang][C++20] Support capturing structured bindings in lambdasCorentin Jabot1-1/+1
This completes the implementation of P1091R3 and P1381R1. This patch allow the capture of structured bindings both for C++20+ and C++17, with extension/compat warning. In addition, capturing an anonymous union member, a bitfield, or a structured binding thereof now has a better diagnostic. We only support structured bindings - as opposed to other kinds of structured statements/blocks. We still emit an error for those. In addition, support for structured bindings capture is entirely disabled in OpenMP mode as this needs more investigation - a specific diagnostic indicate the feature is not yet supported there. Note that the rest of P1091R3 (static/thread_local structured bindings) was already implemented. at the request of @shafik, i can confirm the correct behavior of lldb wit this change. Fixes https://github.com/llvm/llvm-project/issues/54300 Fixes https://github.com/llvm/llvm-project/issues/54300 Fixes https://github.com/llvm/llvm-project/issues/52720 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D122768
2022-06-29[Clang] Rename StringLiteral::isAscii() => isOrdinary() [NFC]Corentin Jabot1-1/+1
"Ascii" StringLiteral instances are actually narrow strings that are UTF-8 encoded and do not have an encoding prefix. (UTF8 StringLiteral are also UTF-8 encoded strings, but with the u8 prefix. To avoid possible confusion both with actuall ASCII strings, and with future works extending the set of literal encodings supported by clang, this rename StringLiteral::isAscii() to isOrdinary(), matching C++ standard terminology. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D128762
2022-06-21Fix an unused-variable warning in release build, NFC.Haojian Wu1-0/+1
2022-06-21[HLSL] Support HLSL vector initializersChris Bieneman1-4/+40
In HLSL vectors are ext_vectors in all respects except that they support a constructor style syntax for initializing vectors. This change adds a translation of vector constructor arguments into initializer lists. This supports two oddities of HLSL syntax: (1) HLSL vectors support constructor syntax (2) HLSL vectors are expanded to constituate components in constructors Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D127802
2022-06-02[Sema] Reject list-initialization of enumeration types from aAkira Hatanaka1-3/+3
brace-init-list containing a single element of a different scoped enumeration type It is rejected because it doesn't satisfy the condition that the element has to be implicitly convertible to the underlying type of the enumeration. http://eel.is/c++draft/dcl.init.list#3.8 Differential Revision: https://reviews.llvm.org/D126084
2022-05-03[randstruct] Move initializer check to be more effectiveBill Wendling1-5/+5
If a randomized structure has an initializer with a dedicated initializer in it, the field initialzed by that dedicated initializer may end up at the end of the RecordDecl. This however may skip the random layout initization check. struct t { int a, b, c, d, e; } x = { .a = 2, 4, 5, 6 }; Let's say that "a" is lands as the last field after randomization. The call to CheckDesignatedInitializer sets the iterator to the end of the initializer list. During the next iteration of the initializer list check, it detects that and fails to issue the error about initializing a randomized struct with non-designated initializer. Instead, it issues an error about "excess elements in struct initializer", which is confusing under these circumstances. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D124694
2022-04-28[randstruct] Randomize all elements of a recordBill Wendling1-2/+4
A record may have more than just FieldDecls in it. If so, then we're likely to drop them if we only randomize the FieldDecls. We need to be careful about anonymous structs/unions. Their fields are made available in the RecordDecl as IndirectFieldDecls, which are listed after the anonymous struct/union. The ordering doesn't appear to be super important, however we place them unrandomized at the end of the RecordDecl just in case. There's also the possiblity of StaticAssertDecls. We also want those at the end. All other non-FieldDecls we place at the top, just in case we get something like: struct foo { enum e { BORK }; enum e a; }; Link: https://github.com/KSPP/linux/issues/185 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123958
2022-04-20Treat `std::move`, `forward`, etc. as builtins.Richard Smith1-0/+4
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`, `move_if_noexcept`, `as_const`, `addressof`, and the libstdc++-specific function `__addressof`. We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect. This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change. We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions. In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken. The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been. This is a re-commit of fc3090109643af8d2da9822d0f99c84742b9c877, a571f82a50416b767fd3cce0fb5027bb5dfec58c, 64c045e25b8471bbb572bd29159c294a82a86a2, and de6ddaeef3aaa8a9ae3663c12cdb57d9afc0f906, and reverts aa643f455a5362de7189eac630050d2c8aefe8f2. This change also includes a workaround for users using libc++ 3.1 and earlier (!!), as apparently happens on AIX, where std::move sometimes returns by value. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123345 Revert "Fixup D123950 to address revert of D123345" This reverts commit aa643f455a5362de7189eac630050d2c8aefe8f2.
2022-04-20Revert "Treat `std::move`, `forward`, etc. as builtins."David Tenty1-4/+0
This reverts commit b27430f9f46b88bcd54d992debc8d72e131e1bd0 as the parent https://reviews.llvm.org/D123345 breaks the AIX CI: https://lab.llvm.org/buildbot/#/builders/214/builds/819
2022-04-20[clang] Add a raw_ostream operator<< overload for QualTypeNathan James1-2/+2
Under the hood this prints the same as `QualType::getAsString()` but cuts out the middle-man when that string is sent to another raw_ostream. Also cleaned up all the call sites where this occurs. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123926
2022-04-17Treat `std::move`, `forward`, etc. as builtins.Richard Smith1-0/+4
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`, `move_if_noexcept`, `as_const`, `addressof`, and the libstdc++-specific function `__addressof`. We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect. This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change. We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions. In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken. The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been. This is a re-commit of fc3090109643af8d2da9822d0f99c84742b9c877, a571f82a50416b767fd3cce0fb5027bb5dfec58c, and 64c045e25b8471bbb572bd29159c294a82a86a25 which were reverted in e75d8b70370435b0ad10388afba0df45fcf9bfcc due to a crasher bug where CodeGen would emit a builtin glvalue as an rvalue if it constant-folds. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123345
2022-04-16[randstruct] Enforce using a designated init for a randomized structBill Wendling1-0/+30
A randomized structure needs to use a designated or default initializer. Using a non-designated initializer will result in values being assigned to the wrong fields. Differential Revision: https://reviews.llvm.org/D123763
2022-04-16Revert "[randstruct] Enforce using a designated init for a randomized struct"Aaron Ballman1-30/+0
This reverts commit aed923b1246ac38335b222b89594516fcf0d6385. It causes some buildbot test failures.
2022-04-16Revert "Treat `std::move`, `forward`, and `move_if_noexcept` as builtins."Vitaly Buka1-4/+0
Revert "Extend support for std::move etc to also cover std::as_const and" Revert "Update test to handle opaque pointers flag flip." It crashes on libcxx tests https://lab.llvm.org/buildbot/#/builders/85/builds/8174 This reverts commit fc3090109643af8d2da9822d0f99c84742b9c877. This reverts commit a571f82a50416b767fd3cce0fb5027bb5dfec58c. This reverts commit 64c045e25b8471bbb572bd29159c294a82a86a25.
2022-04-15Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.Richard Smith1-0/+4
We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect. This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change. We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions. In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken. The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123345
2022-04-15[randstruct] Enforce using a designated init for a randomized structBill Wendling1-0/+30
A randomized structure needs to use a designated or default initializer. Using a non-designated initializer will result in values being assigned to the wrong fields. Differential Revision: https://reviews.llvm.org/D123763
2022-04-14Allow flexible array initialization in C++.Eli Friedman1-4/+0
Flexible array initialization is a C/C++ extension implemented in many compilers to allow initializing the flexible array tail of a struct type that contains a flexible array. In clang, this is currently restricted to C. But this construct is used in the Microsoft SDK headers, so I'd like to extend it to C++. For now, this doesn't handle dynamic initialization; probably not hard to implement, but it's extra code, and I don't think it's necessary for the expected uses. And we explicitly fail out of constant evaluation. I've added some additional code to assert that initializers have the correct size, with or without flexible array init. This might catch issues unrelated to flexible array init. Differential Revision: https://reviews.llvm.org/D123649
2021-11-17[Format, Sema] Use range-based for loops with llvm::reverse (NFC)Kazu Hirata1-6/+6
2021-11-15[clang] retain type sugar in auto / template argument deductionMatheus Izvekov1-2/+2
This implements the following changes: * AutoType retains sugared deduced-as-type. * Template argument deduction machinery analyses the sugared type all the way down. It would previously lose the sugar on first recursion. * Undeduced AutoType will be properly canonicalized, including the constraint template arguments. * Remove the decltype node created from the decltype(auto) deduction. As a result, we start seeing sugared types in a lot more test cases, including some which showed very unfriendly `type-parameter-*-*` types. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: rsmith, #libc, ldionne Differential Revision: https://reviews.llvm.org/D110216
2021-11-15Revert "[clang] retain type sugar in auto / template argument deduction"Matheus Izvekov1-2/+2
This reverts commit 4d8fff477e024698facd89741cc6cf996708d598.
2021-11-13[clang] retain type sugar in auto / template argument deductionMatheus Izvekov1-2/+2
This implements the following changes: * AutoType retains sugared deduced-as-type. * Template argument deduction machinery analyses the sugared type all the way down. It would previously lose the sugar on first recursion. * Undeduced AutoType will be properly canonicalized, including the constraint template arguments. * Remove the decltype node created from the decltype(auto) deduction. As a result, we start seeing sugared types in a lot more test cases, including some which showed very unfriendly `type-parameter-*-*` types. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D110216