[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -4280,3 +4280,12 @@ def PreferredType: InheritableAttr { let Args = [TypeArgument<"Type", 1>]; let Documentation = [PreferredTypeDocumentation]; } + +def CodeAlign: StmtAttr { + let Spellings = [CXX11<"clang", "code_align">, + C23<"clang", "code_align"

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -0,0 +1,124 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=expected,c-local %s erichkeane wrote: ```suggestion // RUN: %clang_cc1 -fsyntax-only -verify=expected,c-local %s -x c ``` https://github.com/llvm/llvm-project/pull/70762

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -0,0 +1,124 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=expected,c-local %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp-local -pedantic -x c++ -std=c++11 %s + +// Add diagnostics tests for Loop attribute: [[clang::code_align()]]. erichkeane wrote:

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,46 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CodeAlignAttrDocs : Documentation { + let Category = DocCatVariable; + let Heading = "clang::code_align"; + let Content = [{ +The ``clang::code_align(N)``

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -0,0 +1,124 @@ +// RUN: %clang_cc1 -fsyntax-only -verify=expected,c-local %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cpp-local -pedantic -x c++ -std=c++11 %s + +// Add diagnostics tests for Loop attribute: [[clang::code_align()]]. + +void foo() { + int i; + int a

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,46 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CodeAlignAttrDocs : Documentation { + let Category = DocCatVariable; + let Heading = "clang::code_align"; + let Content = [{ +The ``clang::code_align(N)``

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -322,6 +322,56 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -788,6 +797,20 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx, } } + // Translate 'loop attributes' arguments to equivalent Attr enums. + // It's being handled separately from LoopHintAttrs not to support + // legacy GNU attributes and prag

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -440,6 +440,14 @@ MDNode *LoopInfo::createMetadata( Ctx, {MDString::get(Ctx, "llvm.loop.parallel_accesses"), AccGroup})); } + // Setting clang::code_align attribute. + if (Attrs.CodeAlign > 0) { erichkeane wrote: Where is this consumed? http

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -322,6 +322,56 @@ static Attr *handleUnlikely(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) UnlikelyAttr(S.Context, A); } +CodeAlignAttr *Sema::BuildCodeAlignAttr(const AttributeCommonInfo &CI, +Expr *E) { + if

[clang] [clang] Add support for new loop attribute [[clang::code_align()]] (PR #70762)

2023-11-01 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,46 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CodeAlignAttrDocs : Documentation { + let Category = DocCatVariable; + let Heading = "clang::code_align"; + let Content = [{ +The ``clang::code_align(N)``

[clang] [clang-tools-extra] [Attributes][HLSL] Teach EnumArgument to refer to an external enum (PR #70835)

2023-11-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/70835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [lldb] [libc] [clang] [libcxx] [lld] [flang] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -0,0 +1,14 @@ +// RUN: %clang -S -### -fopenacc %s 2>&1 | FileCheck %s --check-prefix=CHECK-DRIVER +// CHECK-DRIVER: "-cc1" {{.*}} "-fopenacc" erichkeane wrote: At the moment, there should be no problem with them co-existing. Kernels can be separately gener

[llvm] [libcxx] [libc] [flang] [clang] [lldb] [clang-tools-extra] [lld] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -1342,6 +1342,15 @@ def err_opencl_logical_exclusive_or : Error< def err_openclcxx_virtual_function : Error< "virtual functions are not supported in C++ for OpenCL">; +// OpenACC Support. +def warn_pragma_acc_ignored : Warning< + "unexpected '#pragma acc ...' in program"

[lld] [clang] [clang-tools-extra] [flang] [libcxx] [llvm] [libc] [lldb] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -605,6 +605,17 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, Builder.defineMacro("HIP_API_PER_THREAD_DEFAULT_STREAM"); } } + + if (LangOpts.OpenACC) { +// FIXME: When we have full support for OpenACC, we should set this to the +

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,69 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CoroOnlyDestroyWhenCompleteDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The `coro_only_destroy_when_complete` attribute should be

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,69 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CoroOnlyDestroyWhenCompleteDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The `coro_only_destroy_when_complete` attribute should be

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Didn't dig into the LLVM section of this, but the CFE section looks good delta some small documentation changes. https://github.com/llvm/llvm-project/pull/71014 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,69 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CoroOnlyDestroyWhenCompleteDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The `coro_only_destroy_when_complete` attribute should be

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/71014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,69 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CoroOnlyDestroyWhenCompleteDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The `coro_only_destroy_when_complete` attribute should be

[llvm] [lld] [libc] [libcxx] [flang] [clang-tools-extra] [clang] [lldb] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/70234 >From b3d64b3f744ccb37e334e3aae8d6874cd8391c56 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Mon, 23 Oct 2023 11:09:11 -0700 Subject: [PATCH 1/6] [OpenACC] Initial commit for OpenACC Support This is the ini

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. CFE stuff looks good, but someone more familiar with the LLVM changes needs to do final approval. https://github.com/llvm/llvm-project/pull/71014 ___ cfe-commits mailing list cfe-commits@lists.

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
erichkeane wrote: Also note: This needs a Release Note in ReleaseNotes.rst. https://github.com/llvm/llvm-project/pull/71014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,69 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CoroOnlyDestroyWhenCompleteDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The `coro_only_destroy_when_complete` attribute should be

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. CFE + Release note LGTM. Again, please wait on someone to be review the LLVM changes. https://github.com/llvm/llvm-project/pull/71014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [llvm] [Coroutines] Introduce [[clang::coro_only_destroy_when_complete]] (PR #71014)

2023-11-02 Thread Erich Keane via cfe-commits
@@ -7416,3 +7416,69 @@ that ``p->array`` must have at least ``p->count`` number of elements available: }]; } + +def CoroOnlyDestroyWhenCompleteDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The `coro_only_destroy_when_complete` attribute should be

[clang] [clang] Substitute alias templates from correct context (PR #75069)

2023-12-12 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/75069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-13 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/75332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-13 Thread Erich Keane via cfe-commits
@@ -4486,7 +4487,8 @@ static void TryReferenceListInitialization(Sema &S, if (RefRelationship >= Sema::Ref_Related) { // Try to bind the reference here. TryReferenceInitializationCore(S, Entity, Kind, Initializer, cv1T1, T1, -

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-13 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 nit, otherwise LGTM https://github.com/llvm/llvm-project/pull/75332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-13 Thread Erich Keane via cfe-commits
@@ -69,6 +69,29 @@ OpenACCDirectiveKindEx getOpenACCDirectiveKind(Token Tok) { .Default(OpenACCDirectiveKindEx::Invalid); } +// Translate single-token string representations to the OpenCC Clause Kind. +OpenACCClauseKind getOpenACCClauseKind(Token Tok) {

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-13 Thread Erich Keane via cfe-commits
@@ -69,6 +69,29 @@ OpenACCDirectiveKindEx getOpenACCDirectiveKind(Token Tok) { .Default(OpenACCDirectiveKindEx::Invalid); } +// Translate single-token string representations to the OpenCC Clause Kind. +OpenACCClauseKind getOpenACCClauseKind(Token Tok) { + // auto is a k

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-13 Thread Erich Keane via cfe-commits
@@ -208,6 +233,10 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) { // introspect on the spelling before then. if (FirstTok.isNot(tok::identifier)) { P.Diag(FirstTok, diag::err_acc_missing_directive); + +if (!FirstTok.isAnnotation()) + P.ConsumeAny

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-13 Thread Erich Keane via cfe-commits
@@ -262,12 +291,52 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) { return DirKind; } +bool ParseOpenACCClause(Parser &P) { erichkeane wrote: So the individual clauses each have their own 'grammar'. I DID comment the 'clause-list' below bes

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-13 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/75052 >From 0bcee977f95f87a5ccf7bc53d6cd0a5d9521d963 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Fri, 8 Dec 2023 09:18:40 -0800 Subject: [PATCH 1/3] [OpenACC] Add 'clause' parsing infrastructure plus a few clau

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-13 Thread Erich Keane via cfe-commits
@@ -10431,7 +10437,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, : diag::warn_init_list_type_narrowing) << PostInit->getSourceRange() << PreNarrowingType.getLocalUnqualifiedType() -<< EntityType.getLocalUnq

[clang] [clang] Accept recursive non-dependent calls to functions with deduced return type (PR #75456)

2023-12-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/75456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-14 Thread Erich Keane via cfe-commits
@@ -10431,7 +10437,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, : diag::warn_init_list_type_narrowing) << PostInit->getSourceRange() << PreNarrowingType.getLocalUnqualifiedType() -<< EntityType.getLocalUnq

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-14 Thread Erich Keane via cfe-commits
@@ -10431,7 +10437,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, : diag::warn_init_list_type_narrowing) << PostInit->getSourceRange() << PreNarrowingType.getLocalUnqualifiedType() -<< EntityType.getLocalUnq

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2023-12-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Looks like you got what I meant anyway, and we WERE just passionately agreeing with eachother :) LGTM. https://github.com/llvm/llvm-project/pull/75332 ___ cfe-commits mailing list cfe-commits@

[clang] [Clang][AST] Fix crash in APValue::LValueBase::getType when we have invalid decl (PR #75130)

2023-12-15 Thread Erich Keane via cfe-commits
@@ -70,11 +70,13 @@ QualType APValue::LValueBase::getType() const { // constexpr int *p = &arr[1]; // valid? // // For now, we take the most complete type we can find. -for (auto *Redecl = cast(D->getMostRecentDecl()); Redecl; +for (auto *Redecl = cast(D->ge

[clang] [NFC][CLANG] Rename duplicate loop attributes diagnostic functions (PR #75657)

2023-12-15 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/75657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-18 Thread Erich Keane via cfe-commits
https://github.com/erichkeane updated https://github.com/llvm/llvm-project/pull/75052 >From 0bcee977f95f87a5ccf7bc53d6cd0a5d9521d963 Mon Sep 17 00:00:00 2001 From: erichkeane Date: Fri, 8 Dec 2023 09:18:40 -0800 Subject: [PATCH 1/4] [OpenACC] Add 'clause' parsing infrastructure plus a few clau

[clang] [OpenACC] Add 'clause' parsing infrastructure plus a few clauses (PR #75052)

2023-12-18 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/75052 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC] Implement 'routine' construct parsing (PR #73143)

2023-11-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/73143 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [clang] report inlining decisions with -Wattribute-{warning|error} (PR #73552)

2023-11-27 Thread Erich Keane via cfe-commits
@@ -794,6 +796,13 @@ void BackendConsumer::DontCallDiagHandler(const DiagnosticInfoDontCall &D) { ? diag::err_fe_backend_error_attr : diag::warn_fe_backend_warning_attr) << llvm::demangle(D.getFunctionName()) <<

[clang] [llvm] [clang] report inlining decisions with -Wattribute-{warning|error} (PR #73552)

2023-11-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/73552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang] report inlining decisions with -Wattribute-{warning|error} (PR #73552)

2023-11-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: only a few comments on the CFE, most of the work seems LLVM related. https://github.com/llvm/llvm-project/pull/73552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [llvm] [clang] report inlining decisions with -Wattribute-{warning|error} (PR #73552)

2023-11-27 Thread Erich Keane via cfe-commits
@@ -794,6 +796,13 @@ void BackendConsumer::DontCallDiagHandler(const DiagnosticInfoDontCall &D) { ? diag::err_fe_backend_error_attr : diag::warn_fe_backend_warning_attr) << llvm::demangle(D.getFunctionName()) <<

[clang] [llvm] [clang] report inlining decisions with -Wattribute-{warning|error} (PR #73552)

2023-11-27 Thread Erich Keane via cfe-commits
@@ -93,6 +93,8 @@ def err_fe_backend_error_attr : def warn_fe_backend_warning_attr : Warning<"call to '%0' declared with 'warning' attribute: %1">, BackendInfo, InGroup; +def note_fe_backend_in : Note<"called by function '%0'">; erichkeane wrote: Is this t

[llvm] [clang] [clang] report inlining decisions with -Wattribute-{warning|error} (PR #73552)

2023-11-27 Thread Erich Keane via cfe-commits
@@ -93,6 +93,8 @@ def err_fe_backend_error_attr : def warn_fe_backend_warning_attr : Warning<"call to '%0' declared with 'warning' attribute: %1">, BackendInfo, InGroup; +def note_fe_backend_in : Note<"called by function '%0'">; erichkeane wrote: IDK, that

[clang] Move documentation about -verify from a header to public docs (PR #73694)

2023-11-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Urgh, I finally set a bookmark on that page, so this is going to break that! But yeah, this makes a lot more sense here, and I think ends up being easier to maintain. It passes a quick proofread, so lgtm. https://github.com/llvm/llvm-p

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2023-11-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/70976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2023-11-28 Thread Erich Keane via cfe-commits
@@ -177,17 +177,17 @@ DiagnosticBuilder ClangTidyContext::diag( StringRef CheckName, SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level /* = DiagnosticIDs::Warning*/) { assert(Loc.isValid()); - unsigned ID = DiagEngine->getDiagnosticIDs()->getCusto

[clang-tools-extra] [clang] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2023-11-28 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I like this! I can't really review the tidy stuff immediately, but I think this really makes sense. You DO have some unrelated WS changes that should be removed though. Also, Most of the changes this causes along the way I think are vast improvements

[clang-tools-extra] [clang] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2023-11-28 Thread Erich Keane via cfe-commits
@@ -177,17 +177,17 @@ DiagnosticBuilder ClangTidyContext::diag( StringRef CheckName, SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level /* = DiagnosticIDs::Warning*/) { assert(Loc.isValid()); - unsigned ID = DiagEngine->getDiagnosticIDs()->getCusto

[clang-tools-extra] [clang] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2023-11-28 Thread Erich Keane via cfe-commits
@@ -171,13 +172,61 @@ class DiagnosticMapping { class DiagnosticIDs : public RefCountedBase { public: /// The level of the diagnostic, after it has been through mapping. - enum Level { + enum Level : uint8_t { Ignored, Note, Remark, Warning, Error, Fatal }; + //

[clang] [clang-tools-extra] [clang] Extend diagnose_if to accept more detailed warning information (PR #70976)

2023-11-28 Thread Erich Keane via cfe-commits
@@ -171,13 +172,61 @@ class DiagnosticMapping { class DiagnosticIDs : public RefCountedBase { public: /// The level of the diagnostic, after it has been through mapping. - enum Level { + enum Level : uint8_t { Ignored, Note, Remark, Warning, Error, Fatal }; + //

[clang] [Clang] Implement P2308R1 - Template Parameter Initialization. (PR #73103)

2023-11-29 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I dont think the triple is necessary for the test, otherwise this LGTM! https://github.com/llvm/llvm-project/pull/73103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [clang][NFC] Refactor expected directives in C++ DRs 1-99 (PR #73879)

2023-11-30 Thread Erich Keane via cfe-commits
erichkeane wrote: > > I could nit on the naming conventions here or there, but I think this > > overall is such a vast improvement that I'd rather get 'this', then argue > > on names in future files, and let this one lie. > > @erichkeane Now is the best time to bring those nits on, unless you

[clang] [OpenACC] Implement 'cache' construct parsing (PR #74324)

2023-12-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/74324 The 'cache' construct takes a list of 'vars', which are array-section style definitions. This patch implements the parsing, leaving the lower bound and length of the bound as expressions, so that we can valid

[clang] [clang][Sema] Add -Wswitch-default warning option (PR #73077)

2023-12-04 Thread Erich Keane via cfe-commits
erichkeane wrote: I think there is value to adding this if only for the GCC compat story here. I realize we don't like non-on-by-default warnings, but it IS something that folks use reasonably often, and we've even acquiesced to making it an ignored flag IIRC. Aaron is the real decision make

[clang] [Clang][Sema] Diagnose friend function specialization definitions (PR #72863)

2023-12-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/72863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Exclude non-template classes when checking if constraint refers to containing template arguments (PR #74265)

2023-12-04 Thread Erich Keane via cfe-commits
@@ -1714,6 +1714,8 @@ class ConstraintRefersToContainingTemplateChecker // Friend, likely because it was referred to without its template arguments. void CheckIfContainingRecord(const CXXRecordDecl *CheckingRD) { CheckingRD = CheckingRD->getMostRecentDecl(); +if (!C

[clang] [clang] Exclude non-template classes when checking if constraint refers to containing template arguments (PR #74265)

2023-12-04 Thread Erich Keane via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++20 -verify %s + +template +concept C = true; + +class non_temp { +template T> +friend void f(); + +non_temp(); +}; + +template T> +void f() { +auto v = non_temp(); +} + +template +class temp { +template T> +frien

[clang] [clang] Substitute alias templates from correct context (PR #74335)

2023-12-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/74335 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Substitute alias templates from correct context (PR #74335)

2023-12-04 Thread Erich Keane via cfe-commits
@@ -3990,9 +3990,14 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, if (Inst.isInvalid()) return QualType(); -CanonType = SubstType(Pattern->getUnderlyingType(), - TemplateArgLists, AliasTemplate->getLocation(), -

[clang] [clang] Substitute alias templates from correct context (PR #74335)

2023-12-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I think this is on the right track, 1 nit, else is right I think. https://github.com/llvm/llvm-project/pull/74335 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [clang] Substitute alias templates from correct context (PR #74335)

2023-12-04 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/74335 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Print more static_assert exprs (PR #74852)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/74852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Print more static_assert exprs (PR #74852)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I too would like to see some more complicated dumps for 'complicated' structs (inheritance, multiple inheritance, etc), and vectors/arrays of complicated structs. I am really concerned with the 'depth' that this will show and be unwieldy as a result.

[clang] [Clang][Sema] Print more static_assert exprs (PR #74852)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -6,20 +6,20 @@ struct A { }; static_assert(A{1, 2, 3, 4, 5} == A{1, 2, 3, 4, 5}); -static_assert(A{1, 2, 3, 4, 5} == A{0, 2, 3, 4, 5}); // expected-error {{failed}} -static_assert(A{1, 2, 3, 4, 5} == A{1, 0, 3, 4, 5}); // expected-error {{failed}} -static_assert(A{1, 2, 3

[clang] [Clang] Support MSPropertyRefExpr as placement arg to new-expression (PR #75883)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -2286,6 +2286,9 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, bool PassAlignment = getLangOpts().AlignedAllocation && Alignment > NewAlignment; + if (CheckArgsForPlaceholders(PlacementArgs)) erichkeane wrote:

[clang] [Clang] Support MSPropertyRefExpr as placement arg to new-expression (PR #75883)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -emit-llvm -triple=x86_64-pc-win32 -fms-compatibility %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64-pc-win32 -fms-compatibility -emit-pch -o %t %s +// RUN: %clang_cc1 -emit-llvm -triple=x86_64-pc-win32 -fms-compatibility -include

[clang] [clang][sema] make sure arguments of __atomic_exchange complete type (PR #75135)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -7885,6 +7885,18 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, if ((IsOpenCL || IsHIP || IsScoped) && Op != AtomicExpr::AO__opencl_atomic_init) ++AdjustedNumArgs; + + // Verify if the arguments are of type CompleteType --

[clang] [clang] Report narrowing conversions with const references (PR #75332)

2024-01-03 Thread Erich Keane via cfe-commits
erichkeane wrote: > The change in the diagnostic happens to make it much noisier than it was > before. Our code was clean w.r.t. -Wc++11-narrowing, but now we see hundreds > if not thousands of compilation breakages (we use -Werror, which turns out to > be the only robust way to avoid backslid

[clang] [Sema] Add -Wc++11-narrowing-const-reference (PR #76094)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/76094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Add -Wc++11-narrowing-const-reference (PR #76094)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: Please fix the comments in a followup. https://github.com/llvm/llvm-project/pull/76094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] Add -Wc++11-narrowing-const-reference (PR #76094)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -6158,12 +6158,24 @@ def err_illegal_initializer_type : Error<"illegal initializer type %0">; def ext_init_list_type_narrowing : ExtWarn< "type %0 cannot be narrowed to %1 in initializer list">, InGroup, DefaultError, SFINAEFailure; +// *_narrowing_const_reference diagn

[clang] [Sema] Add -Wc++11-narrowing-const-reference (PR #76094)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -10410,40 +10410,53 @@ static void DiagnoseNarrowingInInitList(Sema &S, // No narrowing occurred. return; - case NK_Type_Narrowing: + case NK_Type_Narrowing: { // This was a floating-to-integer conversion, which is always considered a // narrowing conver

[clang] [llvm] [clang-tools-extra] [Sema] When checking for constraint equivalence, do not calculate satisfaction (PR #74490)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/74490 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Differentiate between identifier and string EnumArgument (PR #68550)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/68550 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AST] Fix crash in APValue::LValueBase::getType when we have invalid decl (PR #75130)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -70,11 +70,13 @@ QualType APValue::LValueBase::getType() const { // constexpr int *p = &arr[1]; // valid? // // For now, we take the most complete type we can find. -for (auto *Redecl = cast(D->getMostRecentDecl()); Redecl; +for (auto *Redecl = cast(D->ge

[clang] [clang][Sema] deleted overriding function can have lax except spec (PR #76248)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: This needs a release note. Also, since this is implementing a core issue, this needs to update a DRs test as well. https://github.com/llvm/llvm-project/pull/76248 ___ cfe-commits mailing list cfe-commits@lists

[clang] [Clang] Fix ICE where C++ Template Instantiation failed to handle attributed lambdas (PR #76523)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/76523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Reword apologetic Clang diagnostic messages (PR #76310)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -5188,7 +5188,7 @@ def err_template_arg_not_object_or_func : Error< def err_template_arg_not_pointer_to_member_form : Error< "non-type template argument is not a pointer to member constant">; def err_template_arg_member_ptr_base_derived_not_supported : Error< - "sorry, no

[clang] [Clang] Correctly construct template arguments for file-scope template template parameters (PR #76811)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This makes sense to me, I think this is right. https://github.com/llvm/llvm-project/pull/76811 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations (PR #76677)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: As Corentin said, needs a release note, else LGTM. https://github.com/llvm/llvm-project/pull/76677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations (PR #76677)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/76677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations (PR #76677)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -518,6 +518,7 @@ Improvements to Clang's diagnostics - Clang now diagnoses definitions of friend function specializations, e.g. ``friend void f<>(int) {}``. - Clang now diagnoses narrowing conversions involving const references. (`#63151:

[clang] [Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations (PR #76677)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/76677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations (PR #76677)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/76677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix failing CI with different test case attribute & test macro (PR #76863)

2024-01-03 Thread Erich Keane via cfe-commits
erichkeane wrote: Is `preserve_most` enabled for all platforms? It looks like it'll eventually go to the `TargetInfo::checkCallingConvention` for each target, and I'm pretty sure we don't support it for all targets. You're likely better off just adding a triple/handful of triples here. https

[clang] [Clang] Fix failing CI with different test case attribute & test macro (PR #76863)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Looks fine to me, triple of x86_64 + gnu should be enough to make sure this is a supported attribute. https://github.com/llvm/llvm-project/pull/76863 ___ cfe-commits mailing list cfe-commits@li

[clang] [Clang] Support MSPropertyRefExpr as placement arg to new-expression (PR #75883)

2024-01-03 Thread Erich Keane via cfe-commits
@@ -2286,6 +2286,9 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, bool PassAlignment = getLangOpts().AlignedAllocation && Alignment > NewAlignment; + if (CheckArgsForPlaceholders(PlacementArgs)) erichkeane wrote:

[clang] Revert "[Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations" (PR #76876)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/76876 Reverts llvm/llvm-project#76677 See discussion here: https://github.com/llvm/llvm-project/pull/76677 >From 687396b5f4ba0713d103ebd172b308e92eb930cc Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Wed, 3 Jan

[clang] Revert "[Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations" (PR #76876)

2024-01-03 Thread Erich Keane via cfe-commits
https://github.com/erichkeane closed https://github.com/llvm/llvm-project/pull/76876 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations (PR #76677)

2024-01-03 Thread Erich Keane via cfe-commits
erichkeane wrote: Reverted here: https://github.com/llvm/llvm-project/pull/76876 @sdkrystian : please take a look at the regression that nico pointed out and re-submit with considerations for that. https://github.com/llvm/llvm-project/pull/76677 ___

[clang] [clang] Constexpr for __builtin_shufflevector and __builtin_convertvector (PR #76615)

2024-01-04 Thread Erich Keane via cfe-commits
Pol Marcet =?utf-8?q?Sardà?= , Pol Marcet =?utf-8?q?Sardà?= Message-ID: In-Reply-To: https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/76615 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

<    1   2   3   4   5   6   7   8   9   10   >