[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)
seanm wrote: @bwendling is there any plan / possibility for simple expressions (with no side effects)? Like: ```c struct libusb_bos_dev_capability_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t dev_capability_data[] __attribute__((counted_by(bLength - 3))); }; ``` https://github.com/llvm/llvm-project/pull/76348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)
seanm wrote: @bwendling thanks for your reply. No idea how representative it is of other projects, but 3 of the 6 flexible arrays in [libusb](https://github.com/libusb/libusb) structures have these kinds of non-trivial counts. The GCC folks seem to have [considered](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896) adding such support, but it's not clear what, if anything, they decided. https://github.com/llvm/llvm-project/pull/76348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable
Friendly ping... this is a very trivial documentation patch... On Wed, 10 Aug 2016 13:57:07 -0400, Sean McBride via cfe-commits said: >Fixed incorrect docs that referred to: > objc_arc_weak_unavailable >when it should be: > objc_arc_weak_reference_unavailable > >Cheers, > >Sean >___ >cfe-commits mailing list >cfe-commits@lists.llvm.org >http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits objc_arc_weak_unavailable-typo.patch Description: Binary data ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable
Fixed incorrect docs that referred to: objc_arc_weak_unavailable when it should be: objc_arc_weak_reference_unavailable Cheers, Sean objc_arc_weak_unavailable-typo.patch Description: Binary data ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18821: Add modernize-bool-to-integer-conversion
On Thu, 7 Apr 2016 15:48:56 +, Alexander Kornienko via cfe-commits said: >Actually, did you think about adding this as a clang diagnostic? > >Richard, what do you think about complaining in Clang about `int i = >true;` kind of code? If you don't mind a lurker interjecting... :) I think that'd be great. I work with an old C++ codebase that started before C++ had 'bool', and so it used 'int' instead. A warning for 'int i = true' would help to convert all those old 'ints' to 'bools'. Cheers, Sean ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [compiler-rt] [llvm] [TySan] A Type Sanitizer (Runtime Library) (PR #76261)
seanm wrote: @fhahn can TySan be made to trap when it detects a problem? I tried `-fsanitize-trap=type` but got: `clang++: error: unsupported argument 'type' to option '-fsanitize-trap='` `-fsanitize-trap=all` does not seem to result in TySan trapping, only logging... https://github.com/llvm/llvm-project/pull/76261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL (PR #135720)
https://github.com/seanm updated https://github.com/llvm/llvm-project/pull/135720 >From cfd32680ac4a534b4060d8cc3549edfe45e721bf Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 14 Apr 2025 20:58:24 -0400 Subject: [PATCH] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL --- .../lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | 1 - clang/test/Analysis/errno-stdlibraryfunctions.c| 3 --- 2 files changed, 4 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp index 9c0b79ab58618..34bab80307a04 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -2663,7 +2663,6 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( .Case({ArgumentCondition(1, WithinRange, Range(1, SizeMax)), IsNull(Ret)}, ErrnoNEZeroIrrelevant, GenericFailureMsg) -.ArgConstraint(NotNull(ArgNo(0))) .ArgConstraint( BufferSize(/*Buffer*/ ArgNo(0), /*BufSize*/ ArgNo(1))) .ArgConstraint( diff --git a/clang/test/Analysis/errno-stdlibraryfunctions.c b/clang/test/Analysis/errno-stdlibraryfunctions.c index 657aa37a42670..0bc82b595eed8 100644 --- a/clang/test/Analysis/errno-stdlibraryfunctions.c +++ b/clang/test/Analysis/errno-stdlibraryfunctions.c @@ -105,9 +105,6 @@ void errno_getcwd(char *Buf, size_t Sz) { clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}} clang_analyzer_eval(Path == NULL); // expected-warning{{TRUE}} if (errno) {} // no warning - } else if (Path == NULL) { -clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}} -if (errno) {} // no warning } else { clang_analyzer_eval(Path == Buf); // expected-warning{{TRUE}} if (errno) {} // expected-warning{{An undefined value may be read from 'errno'}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL (PR #135720)
https://github.com/seanm created https://github.com/llvm/llvm-project/pull/135720 None >From 4ce75d43c62537a7020da0ca737c76e0cca27aca Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 14 Apr 2025 20:58:24 -0400 Subject: [PATCH] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL --- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp index 9c0b79ab58618..34bab80307a04 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -2663,7 +2663,6 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( .Case({ArgumentCondition(1, WithinRange, Range(1, SizeMax)), IsNull(Ret)}, ErrnoNEZeroIrrelevant, GenericFailureMsg) -.ArgConstraint(NotNull(ArgNo(0))) .ArgConstraint( BufferSize(/*Buffer*/ ArgNo(0), /*BufSize*/ ArgNo(1))) .ArgConstraint( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits