r334573 - Remove extraneous semicolon.

2018-06-12 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Jun 12 23:33:59 2018 New Revision: 334573 URL: http://llvm.org/viewvc/llvm-project?rev=334573&view=rev Log: Remove extraneous semicolon. Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.

r345692 - Create ConstantExpr class

2018-10-30 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Oct 30 20:48:47 2018 New Revision: 345692 URL: http://llvm.org/viewvc/llvm-project?rev=345692&view=rev Log: Create ConstantExpr class A ConstantExpr class represents a full expression that's in a context where a constant expression is required. This class reflects the path

r345695 - Change "struct" to "class" to avoid warnings

2018-10-30 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Oct 30 21:58:34 2018 New Revision: 345695 URL: http://llvm.org/viewvc/llvm-project?rev=345695&view=rev Log: Change "struct" to "class" to avoid warnings Modified: cfe/trunk/include/clang/AST/Expr.h Modified: cfe/trunk/include/clang/AST/Expr.h URL: http://llvm.org/view

Re: [PATCH] D53475: Create ConstantExpr class

2018-10-30 Thread Bill Wendling via cfe-commits
I didn't see that during my tests. Probably different -W flags or something. I reverted that bit. I hope it fixes the problem. -bw On Tue, Oct 30, 2018 at 10:02 PM Kristina Brooks via Phabricator < revi...@reviews.llvm.org> wrote: > kristina added a comment. > > Ah, it was causing this warning d

r352307 - Remove Expr sugar decorating the CXXUuidofExpr node.

2019-01-26 Thread Bill Wendling via cfe-commits
Author: void Date: Sat Jan 26 23:24:03 2019 New Revision: 352307 URL: http://llvm.org/viewvc/llvm-project?rev=352307&view=rev Log: Remove Expr sugar decorating the CXXUuidofExpr node. Summary: Sugar, like ConstantExpr, causes an infinite expansion of the template object. Reviewers: rsmith, aaro

r346455 - Compound literals, enums, et al require const expr

2018-11-08 Thread Bill Wendling via cfe-commits
Author: void Date: Thu Nov 8 16:41:36 2018 New Revision: 346455 URL: http://llvm.org/viewvc/llvm-project?rev=346455&view=rev Log: Compound literals, enums, et al require const expr Summary: Compound literals, enums, file-scoped arrays, etc. require their initializers and size specifiers to be c

r346458 - Use correct parameter name in comment.

2018-11-08 Thread Bill Wendling via cfe-commits
Author: void Date: Thu Nov 8 17:04:05 2018 New Revision: 346458 URL: http://llvm.org/viewvc/llvm-project?rev=346458&view=rev Log: Use correct parameter name in comment. Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Modified: cfe/trunk/include/clang/StaticAnalyzer/C

[clang-tools-extra] r346461 - Ignore implicit things like ConstantExpr.

2018-11-08 Thread Bill Wendling via cfe-commits
Author: void Date: Thu Nov 8 17:32:30 2018 New Revision: 346461 URL: http://llvm.org/viewvc/llvm-project?rev=346461&view=rev Log: Ignore implicit things like ConstantExpr. Modified: clang-tools-extra/trunk/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp Modified: clang-tools-extra

[clang-tools-extra] r346467 - Remove unused c'tor.

2018-11-08 Thread Bill Wendling via cfe-commits
Author: void Date: Thu Nov 8 18:03:24 2018 New Revision: 346467 URL: http://llvm.org/viewvc/llvm-project?rev=346467&view=rev Log: Remove unused c'tor. Modified: clang-tools-extra/trunk/modularize/ModuleAssistant.cpp Modified: clang-tools-extra/trunk/modularize/ModuleAssistant.cpp URL: http

Re: [clang-tools-extra] r346461 - Ignore implicit things like ConstantExpr.

2018-11-09 Thread Bill Wendling via cfe-commits
This fix was submitted because a test was failing without it. :-) On Thu, Nov 8, 2018 at 10:08 PM Roman Lebedev wrote: > Test? > > On Fri, Nov 9, 2018 at 4:34 AM Bill Wendling via cfe-commits > wrote: > > > > Author: void > > Date: Thu Nov 8 17:32:30 2018 > &

r347294 - Use is.constant intrinsic for __builtin_constant_p

2018-11-20 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Nov 20 00:53:30 2018 New Revision: 347294 URL: http://llvm.org/viewvc/llvm-project?rev=347294&view=rev Log: Use is.constant intrinsic for __builtin_constant_p Summary: A __builtin_constant_p may end up with a constant after inlining. Use the is.constant intrinsic if it's a

r347364 - Reinstate 347294 with a fix for the failures.

2018-11-20 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Nov 20 15:24:16 2018 New Revision: 347364 URL: http://llvm.org/viewvc/llvm-project?rev=347364&view=rev Log: Reinstate 347294 with a fix for the failures. EvaluateAsInt() is sometimes called in a constant context. When that's the case, we need to specify it as so. Modified:

[clang-tools-extra] r347366 - Update EvaluateAsInt to the new syntax.

2018-11-20 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Nov 20 15:24:39 2018 New Revision: 347366 URL: http://llvm.org/viewvc/llvm-project?rev=347366&view=rev Log: Update EvaluateAsInt to the new syntax. Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp clang-tools-extra/trunk/clang-tid

r347417 - Re-Reinstate 347294 with a fix for the failures.

2018-11-21 Thread Bill Wendling via cfe-commits
Author: void Date: Wed Nov 21 12:44:18 2018 New Revision: 347417 URL: http://llvm.org/viewvc/llvm-project?rev=347417&view=rev Log: Re-Reinstate 347294 with a fix for the failures. Don't try to emit a scalar expression for a non-scalar argument to __builtin_constant_p(). Third time's a charm! Ad

[clang-tools-extra] r347419 - Update call to EvaluateAsInt() to the new syntax.

2018-11-21 Thread Bill Wendling via cfe-commits
Author: void Date: Wed Nov 21 12:45:00 2018 New Revision: 347419 URL: http://llvm.org/viewvc/llvm-project?rev=347419&view=rev Log: Update call to EvaluateAsInt() to the new syntax. Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp clang-tools-extra/trunk

r347446 - The result of is.constant() is unsigned.

2018-11-22 Thread Bill Wendling via cfe-commits
Author: void Date: Thu Nov 22 01:31:08 2018 New Revision: 347446 URL: http://llvm.org/viewvc/llvm-project?rev=347446&view=rev Log: The result of is.constant() is unsigned. Added: cfe/trunk/test/CodeGen/builtin-constant-p.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp Modified: cfe/trunk

r347480 - A __builtin_constant_p() returns 0 with a function type.

2018-11-22 Thread Bill Wendling via cfe-commits
Author: void Date: Thu Nov 22 14:58:06 2018 New Revision: 347480 URL: http://llvm.org/viewvc/llvm-project?rev=347480&view=rev Log: A __builtin_constant_p() returns 0 with a function type. Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/test/CodeGen/builtin-constant-p.c Modified:

r347512 - isEvaluatable() implies a constant context.

2018-11-24 Thread Bill Wendling via cfe-commits
Author: void Date: Sat Nov 24 02:45:55 2018 New Revision: 347512 URL: http://llvm.org/viewvc/llvm-project?rev=347512&view=rev Log: isEvaluatable() implies a constant context. Assume that we're in a constant context if we're asking if the expression can be compiled into a constant initializer. Thi

r347531 - A "constexpr" is evaluated in a constant context. Make sure this is reflected

2018-11-25 Thread Bill Wendling via cfe-commits
Author: void Date: Sun Nov 25 18:10:53 2018 New Revision: 347531 URL: http://llvm.org/viewvc/llvm-project?rev=347531&view=rev Log: A "constexpr" is evaluated in a constant context. Make sure this is reflected if a __builtin_constant_p() is a part of a constexpr. Modified: cfe/trunk/lib/AST/Ex

r348029 - We're in a constant context in the ConstantEmitter.

2018-11-30 Thread Bill Wendling via cfe-commits
Author: void Date: Fri Nov 30 12:40:06 2018 New Revision: 348029 URL: http://llvm.org/viewvc/llvm-project?rev=348029&view=rev Log: We're in a constant context in the ConstantEmitter. Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp cfe/trunk/test/CodeGen/builtin-constant-p.c Modified:

r348032 - Revert r348029. I was git-ing and jumped the gun.

2018-11-30 Thread Bill Wendling via cfe-commits
Author: void Date: Fri Nov 30 12:44:11 2018 New Revision: 348032 URL: http://llvm.org/viewvc/llvm-project?rev=348032&view=rev Log: Revert r348029. I was git-ing and jumped the gun. Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp cfe/trunk/test/CodeGen/builtin-constant-p.c Modified: cf

r348070 - Specify constant context in constant emitter

2018-12-01 Thread Bill Wendling via cfe-commits
Author: void Date: Sat Dec 1 00:29:36 2018 New Revision: 348070 URL: http://llvm.org/viewvc/llvm-project?rev=348070&view=rev Log: Specify constant context in constant emitter The constant emitter may need to evaluate the expression in a constant context. For exasmple, global initializer lists.

r348071 - Correct indentation.

2018-12-01 Thread Bill Wendling via cfe-commits
Author: void Date: Sat Dec 1 01:06:26 2018 New Revision: 348071 URL: http://llvm.org/viewvc/llvm-project?rev=348071&view=rev Log: Correct indentation. Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp URL: http://llvm.org/viewvc/llvm-proj

r368104 - Delay diagnosing asm constraints that require immediates until after inlining

2019-08-06 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Aug 6 15:41:22 2019 New Revision: 368104 URL: http://llvm.org/viewvc/llvm-project?rev=368104&view=rev Log: Delay diagnosing asm constraints that require immediates until after inlining Summary: An inline asm call may result in an immediate input value after inlining. There

r368202 - Add target requirements for those bots which don't handle x86.

2019-08-07 Thread Bill Wendling via cfe-commits
Author: void Date: Wed Aug 7 12:36:48 2019 New Revision: 368202 URL: http://llvm.org/viewvc/llvm-project?rev=368202&view=rev Log: Add target requirements for those bots which don't handle x86. Modified: cfe/trunk/test/CodeGen/pr41027.c Modified: cfe/trunk/test/CodeGen/pr41027.c URL: http:/

r365395 - Add parentheses to silence warnings.

2019-07-08 Thread Bill Wendling via cfe-commits
Author: void Date: Mon Jul 8 15:01:07 2019 New Revision: 365395 URL: http://llvm.org/viewvc/llvm-project?rev=365395&view=rev Log: Add parentheses to silence warnings. Modified: cfe/trunk/lib/Tooling/Syntax/BuildTree.cpp Modified: cfe/trunk/lib/Tooling/Syntax/BuildTree.cpp URL: http://llvm.

r349561 - Emit ASM input in a constant context

2018-12-18 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Dec 18 14:54:03 2018 New Revision: 349561 URL: http://llvm.org/viewvc/llvm-project?rev=349561&view=rev Log: Emit ASM input in a constant context Summary: Some ASM input constraints (e.g., "i" and "n") require immediate values. At O0, very few code transformations are perfor

r349603 - Revert accidentally included code.

2018-12-18 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Dec 18 20:36:42 2018 New Revision: 349603 URL: http://llvm.org/viewvc/llvm-project?rev=349603&view=rev Log: Revert accidentally included code. Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp URL: http://llvm.org/viewvc/llvm-pr

r349604 - Use "EvaluateAsRValue" instead of as a known int, because if it's not a known

2018-12-18 Thread Bill Wendling via cfe-commits
Author: void Date: Tue Dec 18 20:54:29 2018 New Revision: 349604 URL: http://llvm.org/viewvc/llvm-project?rev=349604&view=rev Log: Use "EvaluateAsRValue" instead of as a known int, because if it's not a known integer we want to emit a diagnostic instead of asserting. Modified: cfe/trunk/lib/S

[clang] [clang-tools-extra] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
bwendling wrote: @rapidsna Friendly ping. :-) https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [llvm] [clang-tools-extra] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [clang-tools-extra] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [clang-tools-extra] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [clang-tools-extra] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang-tools-extra] [clang] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [clang-tools-extra] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang] [llvm] [clang-tools-extra] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-08 Thread Bill Wendling via cfe-commits
@@ -859,53 +860,93 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); +// The code generated here calculates

[clang-tools-extra] [llvm] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-09 Thread Bill Wendling via cfe-commits
bwendling wrote: @rapidsna My recent commits try to address a lot of the issues you brought up. If the FAM's array index is negative or out of bounds, it should now catch it and return an appropriate value. There may still be some corner cases that have to be hammered out, but I'd like to get

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-09 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-09 Thread Bill Wendling via cfe-commits
https://github.com/bwendling closed https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-09 Thread Bill Wendling via cfe-commits
https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/71877 GCC returns 0 for a negative index on an array in a structure. It also returns 0 for an array index that goes beyond the extent of the array. In addition. a pointer to a struct field returns that field's size, n

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-11 Thread Bill Wendling via cfe-commits
bwendling wrote: /sub @rapidsna https://github.com/llvm/llvm-project/pull/71877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-13 Thread Bill Wendling via cfe-commits
bwendling wrote: @nathanchance Could you try the patch in https://github.com/bwendling/llvm-project/tree/counted-by-offsets to see if it helps? I'll take a look, but it's going to compile slowly on my machine... https://github.com/llvm/llvm-project/pull/70606 __

[clang] [llvm] [clang-tools-extra] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-14 Thread Bill Wendling via cfe-commits
bwendling wrote: Erm...I meant this one: https://github.com/llvm/llvm-project/compare/main...bwendling:llvm-project:llvm-project/counted-by-offsets https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-04 Thread Bill Wendling via cfe-commits
bwendling wrote: Okay, this was tougher than I thought. I make sure that we're not causing any new side-effects in the code. I try as much as possible to use previously generated code when accessing the `counted_by` variable. I also corrected how offsets were calculated. There are some a few

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
@@ -994,31 +1010,55 @@ class MemberExprBaseVisitor // } Expr *Visit(Expr *E) { -return StmtVisitor::Visit(E); +return StmtVisitor::Visit(E); } - Expr *VisitCastExpr(CastExpr *E) { -return IsExpectedRecordDecl(E) ? E : Visit(E->getSubExpr()); - } - E

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
@@ -1411,6 +1411,8 @@ class CodeGenFunction : public CodeGenTypeCache { /// decls. DeclMapTy LocalDeclMap; + llvm::SmallDenseMap ExprLValueMap; bwendling wrote: Done. https://github.com/llvm/llvm-project/pull/73730 _

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
@@ -1411,6 +1411,8 @@ class CodeGenFunction : public CodeGenTypeCache { /// decls. DeclMapTy LocalDeclMap; + llvm::SmallDenseMap ExprLValueMap; bwendling wrote: It will. I did a test to see how many Exprs are typically stored. For both Linux and Clang,

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
@@ -1411,6 +1411,8 @@ class CodeGenFunction : public CodeGenTypeCache { /// decls. DeclMapTy LocalDeclMap; + llvm::SmallDenseMap ExprLValueMap; bwendling wrote: I do this only when the sanitizer is enabled to keep us from building it unnecessarily. htt

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
bwendling wrote: The problem with adding the code to `CodeGenFunction::EmitArraySubscriptExpr` is that we need to emit the counted_by "count" for more than just an `ArraySubscriptExpr`. Where `ExprLValueMap` is placed catches all of the expressions we're interested in. We're doing something si

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
bwendling wrote: > And ideally, the recursive visit should list those expressions explicitly, > instead aborting on ones we know are bad. I'm sorry, I don't understand what you're talking about here. The whole point of the recursive visit is to find a suitable base pointer. If we run across an

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
bwendling wrote: > I mean, the base case should be "return nullptr", and you should only > explicitly list out expressions you know we need to handle. We shouldn't need > to explicitly mention VisitUnaryPostDec etc. The expression can be arbitrarily complex. For instance this: ``` struct s {

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
bwendling wrote: The `__bdos` stuff is only a subset of the bounds checking code so we should focus on that. It's still messier than that, since it's not always going to be a pointer directly to the FAM (e.g. p->a.b.c.array[index]), but I'll give it a shot. I don't think it's going to be any

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
bwendling wrote: Could you add the .c and .sh files? I'll try to recreate it on my end though. https://github.com/llvm/llvm-project/pull/73730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Bill Wendling via cfe-commits
bwendling wrote: Okay. I should have fixed that issue. https://github.com/llvm/llvm-project/pull/73730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-06 Thread Bill Wendling via cfe-commits
bwendling wrote: > I actually think bdos is more complicated: array bounds checking can handle > arbitrary base expressions, so it doesn't need to examine the base expression > at all. bdos can't do that, so more work is required to handle precisely the > cases you want to handle. Yup! The co

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-06 Thread Bill Wendling via cfe-commits
bwendling wrote: It's the __bdos cases that really benefit from the `ExprLValueMap`. The `LocalDeclMap` will have any `allocas` or globals for local C decls. From that, I'll be able to get enough information to generate the `count` lookup. The `ExprLValueMap` improves this by allowing us to us

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -3022,18 +3022,24 @@ class CodeGenFunction : public CodeGenTypeCache { void EmitBoundsCheck(const Expr *E, const Expr *Base, llvm::Value *Index, QualType IndexType, bool Accessed); + void EmitBoundsCheck(const Expr *E, llvm::Value *Bound, llvm::Val

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -4022,8 +4168,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -994,31 +1010,55 @@ class MemberExprBaseVisitor // } Expr *Visit(Expr *E) { -return StmtVisitor::Visit(E); +return StmtVisitor::Visit(E); } - Expr *VisitCastExpr(CastExpr *E) { -return IsExpectedRecordDecl(E) ? E : Visit(E->getSubExpr()); - } - E

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -994,31 +1010,55 @@ class MemberExprBaseVisitor // } Expr *Visit(Expr *E) { -return StmtVisitor::Visit(E); +return StmtVisitor::Visit(E); } - Expr *VisitCastExpr(CastExpr *E) { -return IsExpectedRecordDecl(E) ? E : Visit(E->getSubExpr()); - } - E

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/73730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-07 Thread Bill Wendling via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang-tools-extra] [llvm] [clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-08 Thread Bill Wendling via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[llvm] [clang] [clang-tools-extra] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-11 Thread Bill Wendling via cfe-commits
bwendling wrote: Friendly ping. https://github.com/llvm/llvm-project/pull/73730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] counted_by attr can apply only to C99 flexible array members (PR #72347)

2023-11-14 Thread Bill Wendling via cfe-commits
https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/72347 Ensure that we're dealing only with C99 flexible array members. I.e. ones with incomplete types: struct s { int count; char array[]; /* note: no size specified */ }; >From 21bea1699d80e53d857bf265

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-14 Thread Bill Wendling via cfe-commits
bwendling wrote: Friendly ping to @rapidsna and @nickdesaulniers https://github.com/llvm/llvm-project/pull/71877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-15 Thread Bill Wendling via cfe-commits
@@ -827,6 +827,165 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +llvm::Value * +CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, +

[clang] [Clang] counted_by attr can apply only to C99 flexible array members (PR #72347)

2023-11-15 Thread Bill Wendling via cfe-commits
https://github.com/bwendling closed https://github.com/llvm/llvm-project/pull/72347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-15 Thread Bill Wendling via cfe-commits
bwendling wrote: > For the test cases, I wonder if it might be good to add __bdos() calls with > type 0 as well. The results should always be the same, but we do want to > check for that. i.e.: > > ` p->array[index] = __builtin_dynamic_object_size(&p->count, 0);` I can do that in a separate c

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-15 Thread Bill Wendling via cfe-commits
bwendling wrote: @kees interesting difference between `0` and `1` in `__bdos()`. You probably know about it, but I was surprised: https://godbolt.org/z/KTeqanjKf https://github.com/llvm/llvm-project/pull/71877 ___ cfe-commits mailing list cfe-commits@

[clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-18 Thread Bill Wendling via cfe-commits
@@ -827,6 +827,165 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +llvm::Value * +CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, +

[clang] [NFC][Clang] Refactor code to calculate flexible array member size (PR #72790)

2023-11-19 Thread Bill Wendling via cfe-commits
https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/72790 The code that calculates the flexible array member size is big enough to warrant its own method. >From fcea607665cdbae3e98f08288b165c2c1af24f95 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 19 Nov 2

[clang] [NFC][Clang] Refactor code to calculate flexible array member size (PR #72790)

2023-11-19 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/72790 >From fcea607665cdbae3e98f08288b165c2c1af24f95 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 19 Nov 2023 02:28:28 -0800 Subject: [PATCH 1/2] [NFC][Clang] Refactor code to calculate flexible array mem

[clang] [NFC][Clang] Refactor code to calculate flexible array member size (PR #72790)

2023-11-19 Thread Bill Wendling via cfe-commits
https://github.com/bwendling closed https://github.com/llvm/llvm-project/pull/72790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-19 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/71877 >From 721415856f1e89d8fbe48e63751a9275b25e0fb8 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 9 Nov 2023 14:15:22 -0800 Subject: [PATCH] [Clang] Correct handling of negative and out-of-bounds indices

[llvm] [clang-tools-extra] [clang] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-19 Thread Bill Wendling via cfe-commits
@@ -827,6 +827,165 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +llvm::Value * +CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, +

[clang] [llvm] [clang-tools-extra] [Clang] Correct handling of negative and out-of-bounds indices (PR #71877)

2023-11-20 Thread Bill Wendling via cfe-commits
https://github.com/bwendling closed https://github.com/llvm/llvm-project/pull/71877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread Bill Wendling via cfe-commits
https://github.com/bwendling created https://github.com/llvm/llvm-project/pull/70606 Break down the counted_by calculations so that they correctly handle anonymous structs, which are specified internally as IndirectFieldDecls. Also simplify the code to use helper methods to get the field referen

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread Bill Wendling via cfe-commits
bwendling wrote: To answer @nickdesaulniers 's question, the testcases are in the works. :-) https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-29 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/2] [CodeGen] Revamp counted_by calculations Break down the co

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/3] [CodeGen] Revamp counted_by calculations Break down the co

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/4] [CodeGen] Revamp counted_by calculations Break down the co

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/5] [CodeGen] Revamp counted_by calculations Break down the co

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr *CodeGenFunction::BuildC

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base = E->IgnoreParenImpCa

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr *CodeGenFunction::BuildC

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -966,9 +962,68 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -FieldDecl *CodeGenFunction::FindCountedByField( -const Expr *Base, -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel) { +Expr *CodeGenFunction::BuildC

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-30 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base = E->IgnoreParenImpCa

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base = E->IgnoreParenImpCa

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling updated https://github.com/llvm/llvm-project/pull/70606 >From 19dd7db8ab5f98a618c717944c96b34e604fbc30 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 29 Oct 2023 14:58:04 -0700 Subject: [PATCH 1/7] [CodeGen] Revamp counted_by calculations Break down the co

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base = E->IgnoreParenImpCa

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
https://github.com/bwendling edited https://github.com/llvm/llvm-project/pull/70606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base = E->IgnoreParenImpCa

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-10-31 Thread Bill Wendling via cfe-commits
@@ -859,53 +859,60 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type, } if (IsDynamic) { -LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = -getLangOpts().getStrictFlexArraysLevel(); -const Expr *Base = E->IgnoreParenImpCa

  1   2   3   4   5   6   7   >