[PATCH] D130224: [Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values

2022-07-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D130224#3677144 , @arsenm wrote: > In D130224#3668243 , @aaron.ballman > wrote: > >> I'm still not seeing the issue fully. My understanding of the situation >> (which may be wro

[PATCH] D130301: [Clang] Fix how we set the NumPositiveBits on an E numDecl to cover the case of single enumerator with value zero or an empty enum

2022-07-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM (aside from some small nits that you can fix when landing). Comment at: compiler-rt/test/ubsan/TestCases/Misc/enum.cpp:27 + return ((int)e1 != -1) & ((int

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. In D124500#3499683 , @LegalizeAdulthood wrote: > OK, so thinking about this review a little more, I propose this: > > - Take the check a

[PATCH] D124966: Thread safety analysis: Handle compound assignment and ->* overloads

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. In D124966#3497781 , @aaronpuchert wrote: > In D124966#3497305 , @aaron.ballman > wrote: > >> Do we need to update any documentation from this

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/line-directive.c:33 # 42 "foo" 2 // expected-error {{invalid line marker flag '2': cannot pop empty include stack}} # 42 "foo" 1 3 // enter # 42 "foo" 2 3 // exit ken-matsui wrote: > a

[PATCH] D124977: [NFC][Clang] Modify expect of fail test or XFAIL because CSKY align is different

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Sema/builtin-alloca-with-align.c:32 void test8(void) { +#if defined(__csky__) __builtin_alloca_with_align(sizeof(__INT64_TYPE__), __alignof__(__INT64_TYPE__)); // expected-warning {{second argument to __builtin_all

[PATCH] D123009: [Sema] Enum conversion warning when one signed and other unsigned.

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision. aaron.ballman added a comment. Thank you for the fix! I've landed on your behalf in 882915df61e33f3a2b7f58e52f572717e1c11499 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D124790: [HLSL] Enable half type for hlsl.

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. This change should likely also have some Sema tests demonstrating what happens during constant expression evaluation, or narrowing conversions, etc given that the type may have different behavior. Comment at: clang/lib/Basic/LangOptions.cpp:197

[PATCH] D124866: [CUDA][HIP] support __noinline__ as keyword

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124866#3497439 , @tra wrote: >> CUDA/HIP do not have language spec. > > Well. It's not completely true. CUDA programming guide does serve as the > de-facto spec for CUDA. It's far from perfect, but it does mention > `_

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:988 +def err_pragma_intrinsic_function_scope : Error< + "'#pragma function/intrinsic' can only appear outside a function, at the global level">; + =

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: erichkeane. aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:10 +// expected-warning@+11 {{'#elfidef' directive not found, did you mean '#elifdef'?}} +// expected-warning@+11 {{'#elfindef' direc

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:441 + constexpr StringRef Candidates[] = { + "if", "ifdef", "ifndef", "elif", "elifdef", "elifndef", "else", "endif" + }; erichkeane wrote: > Should this be dependent on C mode

[PATCH] D122766: [clang] Add the flag -ffile-reproducible

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Driver/Options.td:3020-3023 +HelpText<"remap file source paths in debug info, predefined preprocessor macros and __builtin_FILE(). Implies -ffile-reproducible.">; def fmacro_prefix_map_EQ : Joined<["-"]

[PATCH] D125167: [WIP] Fix member access of anonymous struct/union fields in C

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/docs/ReleaseNotes.rst:152-157 +- When forming a member expression, now consider any qualifiers written on an + anonymous structure or union as also applying to the field being referenced. + This fixes an issue where qualifi

[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124701#3485647 , @steplong wrote: > In D124701#3485317 , @hans wrote: > >> If I understand correctly, D68028 made it >> so that LLVM doesn't ad

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Thank you for working on this! Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:696-698 +def ext_c2x_pp_directive : Extension< + "%select{#elifdef|#elifndef}0 is a C2x extension">, + InGroup; I think we need two diagn

[PATCH] D125142: [clang][auto-init] Remove -enable flag for "zero" mode

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Also, you should definitely add some release notes for this change. Comment at: clang/include/clang/Driver/Options.td:2700-2701 MarshallingInfoEnum, "Uninitialized">; def enable_trivial_var_init_zero : Flag<["-"], "enable-trivial-auto-var-ini

[PATCH] D124866: [CUDA][HIP] support __noinline__ as keyword

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: erichkeane. aaron.ballman added a comment. In D124866#3501181 , @yaxunl wrote: > In D124866#3500761 , @aaron.ballman > wrote: > >> Should we do `__forceinline__` at the same time

[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision. aaron.ballman added reviewers: tahonermann, jyknight, eli.friedman, clang-language-wg. Herald added a project: All. aaron.ballman requested review of this revision. Herald added a project: clang. The controlling expression of a `_Generic` selection expression

[PATCH] D125142: [clang][auto-init] Remove -enable flag for "zero" mode

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D125142#3502732 , @MaskRay wrote: > This cannot be committed as is. In particular, @rsmith's "We do not want to > create or encourage the creation of language dialects and non-portable code," > concern on > https://dis

[PATCH] D122766: [clang] Add the flag -ffile-reproducible

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122766/new/ https://reviews.llvm.org/D122766 ___ cfe-commits mailing list cfe-comm

[PATCH] D124866: [CUDA][HIP] support __noinline__ as keyword

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124866#3501641 , @yaxunl wrote: > If we are to add `__forceinline__` as a keyword, I feel it better be a > separate patch to be cleaner. I'm fine with that. A few nits and a question about the test recently added.

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Thanks, I think we're getting pretty close! Comment at: clang/test/Preprocessor/line-directive-system-headers.c:2-6 -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/line-directive-system-headers.c:2-6 -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' -// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF' -// RUN: not %clang_cc1 -E %s 2>&

[PATCH] D124996: [clang][preprocessor] Fix unsigned-ness of utf8 char literals

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Lexer/utf8-char-literal.cpp:3-4 // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c2x -x c -fsyntax-only -verify %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++1z -fsyntax-only -verify %s +// RUN: %clang

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParsePragma.cpp:3578 + + if (Tok.isNot(tok::l_paren)) { +PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen) steplong wrote: > aaron.ballman wrote: > > Can we use `ExpectAndConsume()`

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. It looks like precommit CI caught some related failures: Failed Tests (7): Clang :: Lexer/deprecate-macro.c Clang :: Lexer/unsafe-macro.c Clang :: Preprocessor/elifdef.c Clang :: Preprocessor/if_warning.c Clang :: Preprocessor/ifdef-recover.c

[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGca75ac5f04f2: Diagnose unreachable generic selection associations (authored by aaron.ballman). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:1702 + + if (Reason) +Diag(Types[i]->getTypeLoc().getBeginLoc(), erichkeane wrote: > Splitting this up into the separate line for only 2 items seems like a waste, >

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1070 +SourceLocation Loc, const llvm::SmallSetVector &Intrinsics) { + if (!CurContext->getRedeclContext()->isFileContext()) { +Diag(Loc, diag::err_pragma_intrinsic_function_scope); -

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x mode

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:696-698 +def ext_c2x_pp_directive : Extension< + "%select{#elifdef|#elifndef}0 is a C2x extension">, + InGroup; ken-matsui wrote: > aaron.ballman wrote: > > ken-mat

[PATCH] D124998: [AArch64][SVE] Add aarch64_sve_pcs attribute to Clang

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. In D124998#3503335 , @paulwalker-arm wrote: > @aaron.ballman It looks like the conversation reached a conclusion? Given > this is sepa

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:3 + +// id: not suggested to '#if' +// ifd: expected-warning@+11 {{invalid preprocessing directive, did you mean '#if'?}} This still suggests that some

[PATCH] D124866: [CUDA][HIP] support __noinline__ as keyword

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/SemaCUDA/noinline.cu:8 +__attribute__((noinline)) void fun2() { } +__attribute__((__noinline__)) void fun3() { } yaxunl wrote: > aaron.ballman wrote: > > yaxunl wrote: > > > aaron.ballman wrote: > > > >

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1070 +SourceLocation Loc, const llvm::SmallSetVector &Intrinsics) { + if (!CurContext->getRedeclContext()->isFileContext()) { +Diag(Loc, diag::err_pragma_intrinsic_function_scope); -

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:3 + +// id: not suggested to '#if' +// ifd: expected-warning@+11 {{invalid preprocessing directive, did you mean '#if'?}} erichkeane wrote: > aaron.bal

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/line-directive-system-headers.c:1-2 +// RUN: %clang_cc1 -std=c99 -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -std=c99 -fsyntax-only -pedantic -verify=system -Wsystem-headers %s +

[PATCH] D124866: [CUDA][HIP] support __noinline__ as keyword

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/SemaCUDA/noinline.cu:8 +__attribute__((noinline)) void fun2() { } +__attribute__((__noinline__)) void fun3() { } yaxunl wrote: > aaron.ballman wrote: > > yaxunl wrote: > > > aaron.ballman wrote: > > > >

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM, thank you for all the hard work on this! I assume you need me to land this on your behalf -- if so, can you let me know what name and email address you would like me to use

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG786c721c2bbd: Add extension diagnostic for linemarker directives (authored by ken-matsui, committed by aaron.ballman). Changed prior to commit: ht

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124534#3504641 , @ken-matsui wrote: > In D124534#3504610 , @aaron.ballman > wrote: > >> LGTM, thank you for all the hard work on this! I assume you need me to land >> this on

[PATCH] D124534: [clang] Add a diagnostic for line directive of a gnu extension

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124534#3505709 , @aaron.ballman wrote: > In D124534#3504641 , @ken-matsui > wrote: > >> (I use this info for every commit on GitHub, but is this what you expected? >> Please l

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1070 +SourceLocation Loc, const llvm::SmallVectorImpl &NoBuiltins) { + if (!CurContext->getRedeclContext()->isFileContext()) { +Diag(Loc, diag::err_pragma_intrinsic_function_scope) << "function"

[PATCH] D125011: [MSVC] Add support for pragma alloc_text

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1136-1137 "expected non-wide string literal in '#pragma %0'">, InGroup; +def warn_pragma_expected_ascii_string : Warning< + "expected ascii string literal in '#pragma %0'">, InG

[PATCH] D125338: [HLSL] add -D option for dxc mode.

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM aside from a testing suggestion. Comment at: clang/test/Driver/dxc_D.hlsl:5 +// CHECK:"-D" "TEST=2" + Maybe we should also test that the m

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:698 +def warn_c2x_compat_pp_directive : Warning< + "use of a '#%select{elifdef|elifndef}0' directive is incompatible with C standards before C2x">, + InGroup, DefaultIgnore; --

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/suggest-typoed-directive.c:10 +// expected-warning@+11 {{'#elfidef' directive not found, did you mean '#elifdef'?}} +// expected-warning@+11 {{'#elfindef' directive not found, did you mean '#elifdef'?}} +/

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. Thanks for all the hard work on this, LGTM! Can you please add a release note to clang/docs/ReleaseNotes.rst for the new functionality (probably best under the `New Pragmas in Cl

[PATCH] D125378: [Attribute] Introduce shuffle attribute to be used for __shfl_sync like cross-lane APIs

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:1323-1344 +def ShuffleDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The ``shuffle`` attribute can be placed on a function declaration. It indicates +that the cal

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: llvm/lib/Support/StringRef.cpp:102 +// Find a similar string in `Candidates`. +Optional StringRef::find_similar_str(const std::vector &Candidates, size_t Dist) const { + // We need to check if `rng` has the exact case-insensitive

[PATCH] D125011: [MSVC] Add support for pragma alloc_text

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Sema/pragma-ms-alloc-text.cpp:5 +#pragma alloc_text(a// expected-warning {{expected ',' in '#pragma alloc_text'}} +#pragma alloc_text(a, a // expected-warning {{missing ')' after '#pragma alloc_text'}} expe

[PATCH] D125338: [HLSL] add -D option for dxc mode.

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM aside from a super minor nit with the test. Comment at: clang/test/Driver/dxc_D.hlsl:14 +// ERROR-NOT: error: \ No newline at end of file You should add the newline back to the end of th

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM aside from a super minor nit in a test file. Can you please add a release note for the new diagnostics as well? I'm happy to land this for you when you're ready, but let me

[PATCH] D125378: [Attribute] Introduce shuffle attribute to be used for __shfl_sync like cross-lane APIs

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D125378#3506446 , @jdoerfert wrote: > What I would suggest, if you want to use C/C++ attributes (which makes sense > to me), is an attribute that avoids undef or introduces frozen: I would prefer to avoid this approach

[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

2022-05-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/CodeGen/CGExpr.cpp:5037 if (auto builtinID = FD->getBuiltinID()) { +std::string AttributeNoBuiltin = "no-builtin-" + FD->getName().str(); std::string FDInlineName = (FD->getName() + ".inline").str(); -

[PATCH] D113793: Comment Sema: Run checks only when appropriate (NFC)

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In general, I think this approach is defensible. Though I do wonder if we want to put an assert in the check functions to assert that the command is what you'd expect, so someone calling the check functions incorrectly will get some early feedback. WDYT? ==

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Oops, it looks like precommit CI found a relevant issue, can you fix it up? Failed Tests (1): Clang :: Preprocessor/elifdef.c Testing Time: 790.67s Skipped :56 Unsupported : 1997 Passed : 87720 Expectedly Fail

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. You should also come up with a release note for the changes. Comment at: clang/include/clang/Basic/DiagnosticLexKinds.td:431-432 +def err_pp_invalid_directive : Error< + "invalid preprocessing directive%select{|, did you mean '#%1'?}0" +>; +def w

[PATCH] D125402: [clang][diag] warn if function returns class type by-const-value

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: aaron.ballman, clang-language-wg. aaron.ballman added a comment. Thank you for working on this new diagnostic! We don't typically add new diagnostics that are off by default unless they're for pedantic diagnostics or are reasonably expected to be enabled by default

[PATCH] D125178: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa1545f51a9ef: Warn if using `elifdef` & `elifndef` in not C2x & C++2b mode (authored by ken-matsui, committed by aaron.ballman). Changed prior to co

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Preprocessor/pragma_microsoft.c:210 +#pragma function(main) // expected-warning {{'main' is not a recognized builtin; consider including }} +#pragma function(// expected-warning

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:1070 +SourceLocation Loc, const llvm::SmallVectorImpl &NoBuiltins) { + if (!CurContext->isFileContext()) { +Diag(Loc, diag::err_pragma_expected_file_scope) << "function"; It loo

[PATCH] D125011: [MSVC] Add support for pragma alloc_text

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM aside from some minor commenting nits that you can fix when landing. Can you also add a release note for the new pragma support? Comment at: clang/include

[PATCH] D125383: [ASTMatchers][clang-tidy][NFC] Hoist 'forEachTemplateArgument' matcher into the core library

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Do you expect to use this matcher in a new check in the immediate future? We usually don't push specialized matchers into ASTMatchers.h but instead try to keep them next to the only check using them. This reduces compile time overhead for everyone building Clang.

[PATCH] D124702: [MSVC] Add support for pragma function

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM, thanks for all the work here! Comment at: clang/docs/ReleaseNotes.rst:272 +- Added support for MSVC's pragma function, which tells the compiler to + generate calls to functions lis

[PATCH] D125383: [ASTMatchers][clang-tidy][NFC] Hoist 'forEachTemplateArgument' matcher into the core library

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. In D125383#3509023 , @whisperity wrote: > In D125383#3508960 , @aaron.ballman > wrote: > >> D

[PATCH] D125383: [ASTMatchers][clang-tidy][NFC] Hoist 'forEachTemplateArgument' matcher into the core library

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Oh, you should probably also add a release note for the new matcher to clang/docs/ReleaseNotes.rst Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125383/new/ https://reviews.llvm.org/D125383 _

[PATCH] D124996: [clang][preprocessor] Fix unsigned-ness of utf8 char literals

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM as well, thank you for this! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124996/new/ https://reviews.llvm.org/D124996 ___ cfe-commits mailing list cfe-commits@lists.l

[PATCH] D124915: Check for resource exhaustion when recursively parsing declarators

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 428969. aaron.ballman added a comment. Rebased. I removed the test coverage because it turned out to not be testing anything. If we exhaust resources, then we don't run the `-verify` to test the diagnostic behavior, and we're relying on the crash bein

[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. I think the only thing missing is an update to the documentation: https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/AttrDocs.td#L5999, and add a release note about the change in functionality. Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D124915: Check for resource exhaustion when recursively parsing declarators

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman marked an inline comment as done. aaron.ballman added inline comments. Comment at: clang/include/clang/Parse/Parser.h:802 + /// more in that case. Use this in code that may recurse deeply (for example, + /// in template instantiation) to avoid stack overflow. + v

[PATCH] D124915: Check for resource exhaustion when recursively parsing declarators

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 428987. aaron.ballman marked an inline comment as done. aaron.ballman added a comment. Simplify the implementation by using the facilities Sema already exposes. The behavior remains the same: F:\source\llvm-project>llvm\out\build\x64-Debug\bin\clang.

[PATCH] D124915: Check for resource exhaustion when recursively parsing declarators

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGc67104172034: Check for resource exhaustion when recursively parsing declarators (authored by aaron.ballman). Repository: rG LLVM Github Monorepo

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Lex/PPDirectives.cpp:1257 // If we reached here, the preprocessing token is not valid! - Diag(Result, diag::err_pp_invalid_directive); + Diag(Result, diag::err_pp_invalid_directive) << 0; ken-matsu

[PATCH] D125383: [ASTMatchers][clang-tidy][NFC] Hoist 'forEachTemplateArgument' matcher into the core library

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D125383#3510906 , @whisperity wrote: > In D125383#3509084 , @aaron.ballman > wrote: > >> Then I think the only thing missing here are updates to >> https://github.com/llvm/llvm

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3510165 , @dexonsmith wrote: > For additional context to my questions above, even though open source clang > hasn't been using `-Wstrict-prototypes`, Xcode has had it on-by-default in > new projects since somet

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3511312 , @aaron.ballman wrote: > However, I think the blocks behavior is a bug based on this: > https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaType.cpp#L728 > and I'd be more than happy to f

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa247ba9d1563: Suggest typo corrections for preprocessor directives

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. LGTM, thank you for this! I adjusted the release note and commit message somewhat when landing to make sure they were detailed enough. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124726/new/ https://reviews.llvm.or

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3511611 , @dexonsmith wrote: > Sure, I'm all for adding a new warning for users that want a pedantic > warning. Can it be put behind a separate flag, such as > `-Wstrict-prototypes-pedantic`, which isn't trigge

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3511632 , @jyknight wrote: > The warnings for this case aren't great: > > int foo(); > > int > foo(int arg) { > return 5; > } Yeah, that's not ideal, I'm looking into it to see if I can improve tha

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3511646 , @dexonsmith wrote: > In D122895#3511611 , @dexonsmith > wrote: > >> Previously, `-Wstrict-prototypes` was useful for preventing actual bugs in >> code. > > Fo

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3511682 , @aaron.ballman wrote: > In D122895#3511632 , @jyknight > wrote: > >> The warnings for this case aren't great: >> >> int foo(); >> >> int >> foo(int ar

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3511855 , @aaron.ballman wrote: > In D122895#3511646 , @dexonsmith > wrote: > >> void f1(void (^block)()); >> >> void f2(void) { >> f1(^(int x) { /* do someth

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3512341 , @aaron.ballman wrote: > I think the current behavior today makes sense but we should see if we can > improve it to make *more* sense. With `-Wstrict-prototypes`, we should > complain about the block w

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:204 + return true; +} + LegalizeAdulthood wrote: > LegalizeAdulthood wrote: > > aaron.ballman wrote: > > > LegalizeAdulthood wrote: > >

[PATCH] D125622: [clang-tidy] Reject invalid enum initializers in C files

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Note, I'm in C standards committee meetings all week this week, so I expect I won't be doing many reviews this week and I'll be catching up as best I can starting next week. Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp

[PATCH] D125026: [clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM, thank you for this! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125026/new/ https://reviews.llvm.org/D125026

[PATCH] D125555: [clang] Add __has_target_feature

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. It's not clear to me why existing facilities shouldn't be extended to cover this case rather than coming up with another feature testing macro. There's already plenty of confusion for users to decide between `__has_feature` and `__has_extension`, and now we're tal

[PATCH] D124446: [clang-tidy] Add the misc-discarded-return-value check

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/DiscardedReturnValueCheck.cpp:28 + + std::uint8_t R = static_cast(ConsumedCalls * 100) / TotalCalls; + assert(R <= 100 && "Invalid percentage, maybe bogus compacted data?"); =

[PATCH] D124726: Suggest typoed directives in preprocessor conditionals

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D124726#3516346 , @nathanchance wrote: > I see an instance of this warning in the Linux kernel due to the "Now, for > unknown directives inside a skipped conditional block, we diagnose the > unknown directive as a warn

[PATCH] D125622: [clang-tidy] Reject invalid enum initializers in C files

2022-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.c:9 + +// C forbids comma operator in initializing expressions. +#define BAD_OP 1, 2 LegalizeAdulthood wrote: > aaron.ballman wrote: > > It's also

[PATCH] D125727: [clang] Avoid suggesting typoed directives in `.S` files

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. I know it's retroactive, but this also LGTM. Thank you for the fix! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125727/new/ https://reviews.llvm.org/D125727 ___ cfe-commi

[PATCH] D124977: [NFC][Clang] Modify expect of fail test or XFAIL because CSKY align is different

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124977/new/ https://reviews.llvm.org/D124977 ___ cfe-commits mailing lis

[PATCH] D124446: [clang-tidy] Add the misc-discarded-return-value check

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/DiscardedReturnValueCheck.cpp:83-86 +void DiscardedReturnValueCheck::onStartOfTranslationUnit() { + ConsumedCalls.clear(); + CallMap.clear(); +} whisperity wrote: > aaron.ballma

[PATCH] D124446: [clang-tidy] Add the misc-discarded-return-value check

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Btw, I'm in C standards meetings all week this week, so my reviews are going to be delayed by a bit, just as an FYI. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124446/new/ https://reviews.llvm.org/D124446 ___

[PATCH] D125814: Fix strict prototype diagnostic wording for definitions

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision. aaron.ballman added reviewers: jyknight, dexonsmith. Herald added a project: All. aaron.ballman requested review of this revision. Herald added a project: clang. Post-commit feedback on https://reviews.llvm.org/D122895 pointed out that the diagnostic wording f

[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D122895#3512314 , @aaron.ballman wrote: > In D122895#3511682 , @aaron.ballman > wrote: > >> In D122895#3511632 , @jyknight >> wrote: >

[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D125259#3519822 , @aeubanks wrote: > $ cat /tmp/a.cc > typedef struct Test { > } Test; > > void f() { > const Test constVal; > _Generic(constVal, const Test : 0); > } > $ ./build/rel/bin/clang -fsyn

[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a subscriber: rsmith. aaron.ballman added a comment. In D125259#3519947 , @aaron.ballman wrote: > Oh wow, good catch! I'll correct this. Oof, the plot thickens... the diagnostic is correct for some types, but is incorrect for others

<    31   32   33   34   35   36   37   38   39   40   >