[PATCH] D148381: [Clang] Implement the 'counted_by' attribute

2023-09-15 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. In D148381#4646833 , @rapidsna wrote: > `-fbounds-safety` doesn't allow this. In our internal adoption experience, we > haven't encountered such use cases yet. So, I think it's best to make the > model restrictive to avoid sur

[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking

2023-08-25 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. Commit is https://github.com/llvm/llvm-project/commit/04e6178ae932c9a1d939dcfe3ef1189f4bbb21aa. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158318/new/ https://reviews.llvm.org/D158318 ___ cfe-commits mailing lis

[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking

2023-08-25 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier closed this revision. fcloutier added a comment. Apologies, I landed the change but forgot to update the commit message to include the "Differential Revision:" link. -_- I'm closing this change and I'll update the GitHub issue, which is linked. CHANGES SINCE LAST ACTION https://rev

[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking

2023-08-24 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 553271. fcloutier added a comment. It seems that clang allows `char` specifiers to match `bool` in `scanf` today, without my change (https://godbolt.org/z/e8PrjY65h). I think that this is a mistake, but that's almost certainly up for debate and I'd like to

[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking

2023-08-22 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added inline comments. Comment at: clang/lib/AST/FormatString.cpp:480-481 + break; +case BuiltinType::Half: +case BuiltinType::Float16: +case BuiltinType::Float: aaron.ballman wrote: > Should these be che

[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking

2023-08-22 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 552579. fcloutier marked an inline comment as done. fcloutier added a comment. Add release note, ensure `bool` as a formatted formal parameter is accepted. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158318/new/ https://reviews.llvm.org/D158318

[PATCH] D158318: [Sema] tolerate more promotion matches in format string checking

2023-08-18 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added a reviewer: aaron.ballman. Herald added a project: All. fcloutier requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. It's been reported that when using __attribute__((format)) on non-variadic f

[PATCH] D137603: [Clang][Sema] Fix attribute((format)) bug on non-variadic functions

2022-12-06 Thread Félix Cloutier via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGcd95d7998c1d: [Clang][Sema] Fix attribute((format)) bug on non-variadic functions (authored by fcloutier). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D1376

[PATCH] D137603: [Clang][Sema] Fix attribute((format)) bug on non-variadic functions

2022-12-02 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 479658. fcloutier added a comment. Fix new fixit test for Windows, where directory separators are backslashes instead of forward slashes. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137603/new/ https://reviews.llvm.org/D137603 Files: clang/d

[PATCH] D137603: [Clang][Sema] Fix attribute((format)) bug on non-variadic functions

2022-12-01 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 479427. fcloutier added a comment. Addressed Aaron's comment about fixits, ran clang-format. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137603/new/ https://reviews.llvm.org/D137603 Files: clang/docs/ReleaseNotes.rst clang/include/clang/Bas

[PATCH] D137714: Do not merge traps in functions annotated optnone

2022-11-10 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier requested changes to this revision. fcloutier added inline comments. This revision now requires changes to proceed. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:5321 + SetLLVMFunctionAttributesForDefinition(D, Fn); CodeGenFunction(*this).GenerateCode(GD, Fn, FI

[PATCH] D137603: [Clang][Sema] Fix attribute((format)) bug on non-variadic functions

2022-11-07 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: ahatanak, dcoughlin, aaron.ballman. fcloutier added a project: clang. Herald added a project: All. fcloutier requested review of this revision. Herald added a subscriber: cfe-commits. The initial implementation

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-07-05 Thread Félix Cloutier via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG92edd74b37c7: Allow non-variadic functions to be attributed with `__attribute__((format))` (authored by fcloutier). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-07-05 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 442396. fcloutier added a comment. There was a merge conflict on the release notes, updating the differential to get a CI build. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112579/new/ https://reviews.llvm

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-07-05 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added inline comments. Comment at: clang/test/SemaCXX/attr-format.cpp:76 + format("bare string"); + format("%s", 123); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}} + format("%s %s %u %d %i %p\n", "hello", s, 10u, x, y, &do_fo

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-07-05 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 442373. fcloutier marked 2 inline comments as done. fcloutier added a comment. Address documentation comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112579/new/ https://reviews.llvm.org/D112579 Files

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-07-05 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. I'm afraid that's also not possible: `D` is a `Decl`, so it doesn't have `getType()`. `Decl` is the tightest-fitting superclass of `BlockDecl`, `FunctionDecl` and `ObjCMethodDecl` (because `BlockDecl` is a direct subclass of it). One option could be to cast the `Decl

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-07-01 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 441703. fcloutier set the repository for this revision to rG LLVM Github Monorepo. fcloutier added a comment. Thanks, Aaron. I wasn't sure how to follow up given how long it had been since the review started. I understand that we're all busy (which explains

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-06-22 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. Would it be better if I asked a colleague to finish the review? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112579/new/ https://reviews.llvm.org/D112579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-06-16 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. Ping CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112579/new/ https://reviews.llvm.org/D112579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2022-06-08 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 435302. fcloutier added a comment. Herald added a project: All. Apologies the long delay: things happened and I was pulled away. I have some time to finish this change now. I recommend re-reading the discussion up to now since it's not _that_ long and it p

[PATCH] D125254: [clang] Allow all string types for all attribute(format) styles

2022-05-12 Thread Félix Cloutier 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 rG91ed7e194181: [clang] Allow all string types for all attribute(format) styles (authored by fcloutier). Changed prior to commit: https://reviews.ll

[PATCH] D125254: [clang] Allow all string types for all attribute(format) styles

2022-05-09 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: NoQ, ahatanak, aaron.ballman. Herald added a project: All. fcloutier requested review of this revision. Herald added a project: clang. It's not unusual to see functions like this: void log(const char *fmt, ...) { va_list ap;

[PATCH] D116635: Add warning to detect when calls passing arguments are made to functions without prototypes.

2022-01-05 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier accepted this revision. fcloutier added a comment. This revision is now accepted and ready to land. I think that this is a good warning and I'll defer to the experts for what has to happen when prototypes merge with K&R definitions :) Comment at: clang/include/clang/

[PATCH] D113636: format_arg attribute does not support nullable instancetype return type

2021-11-12 Thread Félix Cloutier via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG12ab3e6c8402: format_arg attribute does not support nullable instancetype return type (authored by fcloutier). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D

[PATCH] D113636: format_arg attribute does not support nullable instancetype return type

2021-11-10 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: NoQ, ahatanak. fcloutier added a project: clang. Herald added a reviewer: aaron.ballman. fcloutier requested review of this revision. Herald added a subscriber: cfe-commits. Following up with D112670 , it

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2021-10-29 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. Thanks Arthur for your feedback. void myprintf(const char *fmt, int n) __attribute__((format(printf, 1, 2))); // N.B.: int, not unsigned long int main() { myprintf("%lu", 3uL); // this should error myprintf("%d", 3uL); // this should not error } T

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2021-10-29 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. Thanks for looking, Aaron. You're right that the main utility of the aggregation of format warnings is to extend C's type checking because there is no other good way, or good place, to do it. I have built hundreds of millions of shipping lines of C, C++ and Objective-

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-28 Thread Félix Cloutier 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 rG6a5f7437720e: format_arg attribute should allow instancetype in NSString definition (authored by fcloutier). Repository: rG LLVM Github Monorepo

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-28 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 383227. fcloutier added a comment. Add test for a protocol method with `format_arg`, second NSString method accepting a NSString instead of a C string Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112670/new/

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-28 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 383222. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112670/new/ https://reviews.llvm.org/D112670 Files: clang/lib/Sema/SemaDeclAttr.cpp clang/test/SemaObjC/format-arg-attribute.m Index: clang/test/Sema

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-28 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added a comment. Apologies, Phabricator showed the comment below line 197 in the diff, but the email showed it to be below line 3404. I can check if the return type is `instancetype` in `handleFormatArgAttr` and use that instead. Repository: rG LLVM Github Monorepo CHANGES SINCE L

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-28 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:3403 } Ty = getFunctionOrMethodResultType(D); if (!isNSStringType(Ty, S.Context, /*AllowNSAttributedString=*/true) && ahatanak wrote: > Is it possible to just replace `Ty` with

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-28 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 383179. fcloutier added a comment. Forgot to run clang-format. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112670/new/ https://reviews.llvm.org/D112670 Files: clang/lib/Sema/SemaDeclAttr.cpp clang/test

[PATCH] D112569: -Wformat-nonliteral should not trigger for format strings passed to blocks with __attribute__((format))

2021-10-27 Thread Félix Cloutier via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd378a0febc7e: [Sema] Recognize format argument indicated by format attribute inside blocks (authored by fcloutier). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D112670: __attribute__((format_arg(__NSString__, N))) does not support instancetype in NSString interface

2021-10-27 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: doug.gregor, dcoughlin, rsmith, NoQ, ahatanak. fcloutier added a project: clang. Herald added a reviewer: aaron.ballman. fcloutier requested review of this revision. Herald added a subscriber: cfe-commits. It has come to my attention that

[PATCH] D112569: -Wformat-nonliteral should not trigger for format strings passed to blocks with __attribute__((format))

2021-10-27 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 382788. fcloutier added a reviewer: ahatanak. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112569/new/ https://reviews.llvm.org/D112569 Files: clang/lib/Sema/SemaChecking.cpp clang/test/Sema/format-string

[PATCH] D112579: Allow non-variadic functions to be attributed with `__attribute__((format))`

2021-10-26 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: dcoughlin, doug.gregor, rsmith. fcloutier added a project: clang. Herald added a reviewer: aaron.ballman. fcloutier requested review of this revision. Herald added a subscriber: cfe-commits. Clang only allows you to use `__attribute__((fo

[PATCH] D112569: -Wformat-nonliteral should not trigger for format strings passed to blocks with __attribute__((format))

2021-10-26 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 382461. fcloutier added a comment. Thanks Artem for pointing out that I was completely misusing `getFunctionScopeIndex`. This should be better. I added a test that you can pick a non-1 value for the format parameter in blocks. CHANGES SINCE LAST ACTION

[PATCH] D112569: -Wformat-nonliteral should not trigger for format strings passed to blocks with __attribute__((format))

2021-10-26 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: doug.gregor, dcoughlin, rsmith. fcloutier added a project: clang. fcloutier requested review of this revision. Herald added a subscriber: cfe-commits. The checker that implements `-Wformat-nonliteral` does not understand `__attribute__((

[PATCH] D96196: [Sema][NFC] Create Sema::BuildImplicitCast

2021-02-05 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. Herald added a subscriber: jfb. Herald added a reviewer: aaron.ballman. fcloutier requested review of this revision. Herald added a reviewer: jdoerfert. Herald added subscribers: cfe-commits, sstefan1. Herald added a project: clang. This change creates Sema::BuildI

[PATCH] D95695: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified

2021-02-03 Thread Félix Cloutier 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 rG554cf3729e65: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic… (authored by fcloutier). Repository: rG LLVM Github Mo

[PATCH] D95695: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified

2021-02-02 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier added inline comments. Comment at: clang/test/AST/ast-print-attr.c:31 +// CHECK: int fun_annotate() __attribute__((annotate("annotation"))) +int fun_annotate() __attribute__((annotate("annotation"))); aaron.ballman wrote: > Can you add a second test tha

[PATCH] D95695: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified

2021-02-02 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 320904. fcloutier added a comment. Address Aaron's feedback Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95695/new/ https://reviews.llvm.org/D95695 Files: clang/test/AST/ast-print-attr.c clang/utils/Tab

[PATCH] D95695: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified

2021-01-29 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier updated this revision to Diff 320204. fcloutier added a comment. Updating the diff using arcanist, which I'm told produces better results. Sorry for the churn! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95695/new/ https://reviews.llvm

[PATCH] D95695: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified

2021-01-29 Thread Félix Cloutier via Phabricator via cfe-commits
fcloutier created this revision. fcloutier added reviewers: jkorous, dcoughlin. fcloutier added a project: clang. Herald added a subscriber: Charusso. Herald added a reviewer: aaron.ballman. fcloutier requested review of this revision. Herald added a subscriber: cfe-commits. Since it gained a new