[PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-05 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision. ahatanak added a subscriber: cfe-commits. This patch fixes a warning that is issued when -Wpadded is on clang's command line. The following warning is from the build log of http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_abi/554/consoleText (note that I see

Re: [PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2016-01-07 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. ping http://reviews.llvm.org/D15599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15097: [Sema] Issue a warning for integer overflow in struct initializer

2016-01-08 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. ping http://reviews.llvm.org/D15097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15097: [Sema] Issue a warning for integer overflow in struct initializer

2016-01-09 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. OK, thank you for the review. I'll commit this patch in a day or two unless someone comes up with a better solution. http://reviews.llvm.org/D15097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm

Re: [PATCH] D15097: [Sema] Issue a warning for integer overflow in struct initializer

2016-01-11 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL257357: [Sema] Issue a warning for integer overflow in struct initializer (authored by ahatanak). Changed prior to commit: http://reviews.llvm.org/D15097?vs=41451&id=44521#toc Repository: rL LLVM ht

r257357 - [Sema] Issue a warning for integer overflow in struct initializer

2016-01-11 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Mon Jan 11 11:22:01 2016 New Revision: 257357 URL: http://llvm.org/viewvc/llvm-project?rev=257357&view=rev Log: [Sema] Issue a warning for integer overflow in struct initializer Clang wasn't issuing a warning when compiling the following code: struct s { unsigned x; } s

Re: r257357 - [Sema] Issue a warning for integer overflow in struct initializer

2016-01-11 Thread Akira Hatanaka via cfe-commits
It triggers in dead branches and so does an initialization of an integer variable declared in a function. I’ll look into fixing it. > On Jan 11, 2016, at 9:54 AM, Joerg Sonnenberger via cfe-commits > wrote: > > On Mon, Jan 11, 2016 at 05:22:01PM -, Akira Hatanaka via cfe-comm

Re: [PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2016-01-12 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. In http://reviews.llvm.org/D15599#325113, @hans wrote: > Just out of curiosity, where does this come up in practice? I only have a short test case a user provided so t's not really clear whether it was necessary to mark a member function naked or there were other ways

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-13 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. Ping. The same pragma is being used in other places (regex.cpp and locale.cpp) to silence the warning. http://reviews.llvm.org/D15897 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/m

r257865 - [CodeGen] Attach attributes to thread local wrapper function.

2016-01-14 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Thu Jan 14 21:34:06 2016 New Revision: 257865 URL: http://llvm.org/viewvc/llvm-project?rev=257865&view=rev Log: [CodeGen] Attach attributes to thread local wrapper function. This commit is a follow-up to r251734, r251476, and r249735, which fixes a bug where function attrib

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-15 Thread Akira Hatanaka via cfe-commits
ahatanak added reviewers: mclow.lists, EricWF, joerg, howard.hinnant. ahatanak added a comment. Adding reviewers http://reviews.llvm.org/D15897 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cf

Re: [PATCH] D12664: Fixed comparison.

2016-01-19 Thread Akira Hatanaka via cfe-commits
ahatanak added a subscriber: ahatanak. ahatanak added a comment. This looks LGTM. http://reviews.llvm.org/D12664 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2016-01-20 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. ping http://reviews.llvm.org/D15599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2016-01-22 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CodeGenFunction.cpp:1962 @@ +1961,3 @@ +for (auto *U : I->users()) + InstrsToRemove.push_back(cast(U)); + manmanren wrote: > Do we need to check if the user has been erased? I am not sure if the same

Re: [PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2016-01-25 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/CodeGenFunction.cpp:1954 @@ +1953,3 @@ + // Erase all allocas and their users. + for (auto I = EntryBB->begin(); &*I != &*AllocaInsertPt; ++I) +if (auto Alloca = dyn_cast(&*I)) hans wrote: > would decla

Re: [PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2016-01-25 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 45910. ahatanak added a comment. Address review comments from Hans and Manman. http://reviews.llvm.org/D15599 Files: lib/CodeGen/CGCall.cpp lib/CodeGen/CGStmt.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenFunction.h test/CodeGen/attr-nak

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-25 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. Maybe we can just remove -Wpadded from buildit's command line for now? If we decide in the future it's worthwhile to use -Wpadded, we can put it back and commit this patch. Also in that case we should make sure cmake uses the option too. http://reviews.llvm.org/D1589

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. Do you mean "-Wpadded -Wno-error=padded" instead of padding? I'm looking for a way to silence the warning, so that isn't enough. If we need more time to decide whether we want to use -Wpadded (for both buildit and cmake), I think I'll just remove -Wpadded from buildit'

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. There is also a PR about splitting -Wpadded into two options: one warns about padding in the middle of a struct and the other warns about padding at the end. If the former option is used instead of -Wpadded, I believe it's possible to remove the pragmas that are curren

Re: [PATCH] D16564: Fix an issue where backend crashes after frontend emits an error message

2016-01-26 Thread Akira Hatanaka via cfe-commits
ahatanak added inline comments. Comment at: lib/CodeGen/ModuleBuilder.cpp:219 @@ -211,2 +218,3 @@ + } } Is it possible to avoid the code duplication if the condition is inverted as shown below? if (!Diags.hasErrorOccurred()) // call Builder->Releas

[libcxx] r258900 - [libcxx] Remove -Wpadded from buildit script.

2016-01-26 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Tue Jan 26 19:55:11 2016 New Revision: 258900 URL: http://llvm.org/viewvc/llvm-project?rev=258900&view=rev Log: [libcxx] Remove -Wpadded from buildit script. Per discussion with Eric and Joerg, this commit removes -Wpadded to silence the warning about the padding inserted a

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Akira Hatanaka via cfe-commits
ahatanak abandoned this revision. ahatanak added a comment. Abandoning this patch as I've removed -Wpadded in r258900. http://reviews.llvm.org/D15897 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listi

[libcxx] r259023 - [libcxx] Remove pragmas that were needed to suppress warnings produced

2016-01-27 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Thu Jan 28 00:13:36 2016 New Revision: 259023 URL: http://llvm.org/viewvc/llvm-project?rev=259023&view=rev Log: [libcxx] Remove pragmas that were needed to suppress warnings produced by -Wpadded. We don't need these pragmas anymore because -Wpadded was removed from buildit

Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 40060. ahatanak marked 2 inline comments as done. ahatanak added a comment. Added "expected-no-diagnostics" to test case. http://reviews.llvm.org/D12547 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td lib/CodeGen/CGCall.cpp lib/S

r252912 - Add support for driver option -mno-ms-bitfields.

2015-11-12 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Thu Nov 12 11:21:22 2015 New Revision: 252912 URL: http://llvm.org/viewvc/llvm-project?rev=252912&view=rev Log: Add support for driver option -mno-ms-bitfields. This option is used to cancel -mms-bitfields on the command line. rdar://problem/15898553 Added: cfe/trunk/

Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Akira Hatanaka via cfe-commits
ahatanak marked an inline comment as done. ahatanak added a comment. I'll commit this patch shortly. Thank you for the review. http://reviews.llvm.org/D12547 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailm

r252986 - Add support for function attribute 'disable_tail_calls'.

2015-11-12 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Thu Nov 12 18:42:21 2015 New Revision: 252986 URL: http://llvm.org/viewvc/llvm-project?rev=252986&view=rev Log: Add support for function attribute 'disable_tail_calls'. The ``disable_tail_calls`` attribute instructs the backend to not perform tail call optimization inside t

Re: [PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-11-12 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL252986: Add support for function attribute 'disable_tail_calls'. (authored by ahatanak). Changed prior to commit: http://reviews.llvm.org/D12547?vs=40060&id=40099#toc Repository: rL LLVM http://revi

Re: [PATCH] D14471: [AArch64] Fix a crash in driver

2015-11-12 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. > If you can get the CPU name, return it. If not, return "native". If you're on > AArch64 and you can't get the CPU name, that's a bug that needs fixing. If > it's always "generic", that's another piece of code that needs fixing. If > whatever getCPU function you use d

Re: [PATCH] D13834: Produce a better diagnostic for global register variables

2015-11-17 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. Thanks, I'll commit this patch shortly. If it makes the code cleaner, I can define enums in TargetInfo and change validateGlobalRegisterVariable to return one of them in a follow-up patch. http://reviews.llvm.org/D13834 _

Re: [PATCH] D13834: Produce a better diagnostic for global register variables

2015-11-17 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL253405: Produce a better diagnostic for global register variables. (authored by ahatanak). Changed prior to commit: http://reviews.llvm.org/D13834?vs=39774&id=40451#toc Repository: rL LLVM http://re

r253405 - Produce a better diagnostic for global register variables.

2015-11-17 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Tue Nov 17 18:15:28 2015 New Revision: 253405 URL: http://llvm.org/viewvc/llvm-project?rev=253405&view=rev Log: Produce a better diagnostic for global register variables. Currently, when there is a global register variable in a program that is bound to an invalid register,

[PATCH] D15097: [Sema] Issue a warning for integer overflow in struct initializer

2015-11-30 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision. ahatanak added a subscriber: cfe-commits. Issue a warning if an initializing integer expression overflows. For example, clang should issue a warning when compiling the following code because 4 * 1024 * 1024 * 1024 doesn't fit into a 32-bit integer: struct s { uns

[PATCH] D15463: [Objective-c] Fix a crash

2015-12-11 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision. ahatanak added a subscriber: cfe-commits. This patch fixes a crash that occurs when __kindof is incorrectly used in the type parameter list of an interface. The crash occurs because ObjCTypeParamList::back() is called in checkTypeParamListConsistency on an empty

Re: [PATCH] D15463: [Objective-c] Fix a crash

2015-12-14 Thread Akira Hatanaka via cfe-commits
On Mon, Dec 14, 2015 at 10:39 AM, Justin Bogner wrote: > Akira Hatanaka via cfe-commits writes: > > ahatanak created this revision. > > ahatanak added a subscriber: cfe-commits. > > > > This patch fixes a crash that occurs when __kindof is incorrectly used > >

Re: [PATCH] D15097: [Sema] Issue a warning for integer overflow in struct initializer

2015-12-14 Thread Akira Hatanaka via cfe-commits
ping On Mon, Nov 30, 2015 at 4:30 PM, Akira Hatanaka wrote: > ahatanak created this revision. > ahatanak added a subscriber: cfe-commits. > > Issue a warning if an initializing integer expression overflows. > > For example, clang should issue a warning when compiling the following > code because

Re: [PATCH] D15463: [Objective-c] Fix a crash

2015-12-15 Thread Akira Hatanaka via cfe-commits
On Tue, Dec 15, 2015 at 12:55 PM, Justin Bogner wrote: > Akira Hatanaka writes: > > On Mon, Dec 14, 2015 at 10:39 AM, Justin Bogner > > wrote: > > > >> Akira Hatanaka via cfe-commits writes: > >> > ahatanak created this revision. >

r255754 - [Objective-c] Fix a crash that occurs when ObjCTypeParamList::back() is

2015-12-15 Thread Akira Hatanaka via cfe-commits
Author: ahatanak Date: Wed Dec 16 00:25:38 2015 New Revision: 255754 URL: http://llvm.org/viewvc/llvm-project?rev=255754&view=rev Log: [Objective-c] Fix a crash that occurs when ObjCTypeParamList::back() is called on an empty list. This commit makes Parser::parseObjCTypeParamListOrProtocolRefs re

Re: [PATCH] D15463: [Objective-c] Fix a crash

2015-12-15 Thread Akira Hatanaka via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL255754: [Objective-c] Fix a crash that occurs when ObjCTypeParamList::back() is (authored by ahatanak). Changed prior to commit: http://reviews.llvm.org/D15463?vs=42560&id=42962#toc Repository: rL LL

Re: [PATCH] D15463: [Objective-c] Fix a crash

2015-12-15 Thread Akira Hatanaka via cfe-commits
gt; wrote: > > > >> Akira Hatanaka writes: > >> > On Mon, Dec 14, 2015 at 10:39 AM, Justin Bogner < > m...@justinbogner.com> > >> > wrote: > >> > > >> >> Akira Hatanaka via cfe-commits writes: > >> >> > ahat

[PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

2015-12-16 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision. ahatanak added a subscriber: cfe-commits. clang crashes when it compiles a member function or a lambda is marked as "naked": struct S { __attribute__((naked)) S() {} } To fix this bug, this patch defines a function that cleans up the naked function removing al

[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)

2024-02-22 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: I think I've addressed all the feedback I got. Are there any other comments? https://github.com/llvm/llvm-project/pull/67454 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [clang] Implement function pointer type discrimination (PR #96992)

2024-07-02 Thread Akira Hatanaka via cfe-commits
@@ -2220,6 +2220,11 @@ llvm::Constant *ConstantLValueEmitter::emitPointerAuthPointer(const Expr *E) { // The assertions here are all checked by Sema. assert(Result.Val.isLValue()); + auto *Base = Result.Val.getLValueBase().get(); + if (auto *Decl = dyn_cast_or_null(Base

[clang] [clang] Implement function pointer type discrimination (PR #96992)

2024-07-02 Thread Akira Hatanaka via cfe-commits
@@ -3140,6 +3140,269 @@ ASTContext::getPointerAuthVTablePointerDiscriminator(const CXXRecordDecl *RD) { return llvm::getPointerAuthStableSipHash(Str); } +/// Encode a function type for use in the discriminator of a function pointer +/// type. We can't use the itanium scheme

[clang] [clang] Implement function pointer type discrimination (PR #96992)

2024-07-02 Thread Akira Hatanaka via cfe-commits
@@ -2220,6 +2220,11 @@ llvm::Constant *ConstantLValueEmitter::emitPointerAuthPointer(const Expr *E) { // The assertions here are all checked by Sema. assert(Result.Val.isLValue()); + auto *Base = Result.Val.getLValueBase().get(); + if (auto *Decl = dyn_cast_or_null(Base

[clang] [CodeGen] Add a flag to disable emitting block signature strings (PR #96944)

2024-07-03 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: Sorry, I didn't remember that I had to set `BLOCK_HAS_SIGNATURE` to 0. https://github.com/llvm/llvm-project/pull/96944 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Add a flag to disable emitting block signature strings (PR #96944)

2024-07-03 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/96944 >From d21bdaec94a169b27e7f7bace399e77bf99fd572 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 25 Jun 2024 19:37:46 -0700 Subject: [PATCH 1/2] [CodeGen] Add a flag to disable emitting block signature s

[clang] [clang] Implement function pointer type discrimination (PR #96992)

2024-07-08 Thread Akira Hatanaka via cfe-commits
@@ -5,55 +5,65 @@ // RUN: -fptrauth-vtable-pointer-address-discrimination \ // RUN: -fptrauth-vtable-pointer-type-discrimination \ // RUN: -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,CALLS,RETS,VPTR_ADDR_DISCR,VPTR_TYPE_DISCR,INITFINI +// RUN:

[clang] [clang] Implement function pointer type discrimination (PR #96992)

2024-07-08 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/96992 >From cf22a4be007f7e6fdc6e4c17c1f32fa70440b123 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 26 Jun 2024 13:02:31 -0700 Subject: [PATCH 1/4] [clang] Implement function pointer type discrimination Giv

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-09 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: @rjmccall sent an RFC for upstreaming pointer authentication work to llvm-dev in 2019, which mentions the `__ptrauth` qualifier. https://discourse.llvm.org/t/rfc-pointer-authentication-for-arm64e/53433 I don't think we sent an RFC for adding support for the `__ptrauth` qualifie

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-09 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: I'll try to come up with an RFC for the qualifier today. https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-14 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: RFC for `__ptrauth`: https://discourse.llvm.org/t/rfc-ptrauth-qualifier/80710 https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-05 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/94515 VarDecl::isNull() doesn't tell whether the VarDecl has an initializer as methods like ensureEvaluatedStmt can create an EvaluatedStmt even when there isn't an initializer. Revert e1c3e16d24b5cc097ff08e9283f533

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-05 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/94515 >From 22a8fa09e81337f45c2ed94e229f06e9aaa32c0e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 5 Jun 2024 11:02:31 -0700 Subject: [PATCH] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-05 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak ready_for_review https://github.com/llvm/llvm-project/pull/94515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix spurious non-strict availability warning (PR #94377)

2024-06-06 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak approved this pull request. https://github.com/llvm/llvm-project/pull/94377 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #86923)

2024-06-07 Thread Akira Hatanaka via cfe-commits
@@ -201,14 +211,26 @@ template <> struct DominatingValue { class saved_type { enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral, AggregateAddress, ComplexAddress }; - -llvm::Value *Value; -llvm::Type *ElementType; +union { + struc

[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #86923)

2024-06-07 Thread Akira Hatanaka via cfe-commits
@@ -201,14 +211,26 @@ template <> struct DominatingValue { class saved_type { enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral, AggregateAddress, ComplexAddress }; - -llvm::Value *Value; -llvm::Type *ElementType; +union { + struc

[clang] [CodeGen] Remove IsVolatile from DominatingValue::save_type (PR #95165)

2024-06-11 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/95165 Prior to 84780af4b02cb3b86e4cb724f996bf8e02f2f2e7, the class didn't have any information about whether the saved value was volatile. This is NFC as far as I can tell. >From 09faa416eb234ab3bf8e1babb3a7c206968e

[clang] [CodeGen] Remove IsVolatile from DominatingValue::save_type (PR #95165)

2024-06-11 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak ready_for_review https://github.com/llvm/llvm-project/pull/95165 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Remove IsVolatile from DominatingValue::save_type (PR #95165)

2024-06-12 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak closed https://github.com/llvm/llvm-project/pull/95165 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #86923)

2024-06-13 Thread Akira Hatanaka via cfe-commits
@@ -201,14 +211,26 @@ template <> struct DominatingValue { class saved_type { enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral, AggregateAddress, ComplexAddress }; - -llvm::Value *Value; -llvm::Type *ElementType; +union { + struc

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-13 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/94515 >From 22a8fa09e81337f45c2ed94e229f06e9aaa32c0e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 5 Jun 2024 11:02:31 -0700 Subject: [PATCH 1/2] Check whether EvaluatedStmt::Value is valid in VarDecl::has

[clang] Check whether EvaluatedStmt::Value is valid in VarDecl::hasInit (PR #94515)

2024-06-14 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak closed https://github.com/llvm/llvm-project/pull/94515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement function pointer signing and authenticated function calls (PR #93906)

2024-06-21 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak closed https://github.com/llvm/llvm-project/pull/93906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-21 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: > I think my last comment/question is still open? How/why did the symbol name > end up dropping any llvm/clang component to avoid collisions with other names? I dropped llvm/clang because I didn't think it would cause any collision in practice, but I don't think we have to try

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-21 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/79230 >From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 16 Jan 2024 13:18:09 -0800 Subject: [PATCH 01/17] Add support for builtin_verbose_trap The builtin causes

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-06-21 Thread Akira Hatanaka via cfe-commits
@@ -27,6 +27,9 @@ namespace llvm { } } +// Prefix for __builtin_verbose_trap. +#define CLANG_VERBOSE_TRAP_PREFIX "__llvm_verbose_trap" ahatanak wrote: I don't have any preference, but according to people working on lldb, macro would make it marginally easi

[clang] Use cast_or_null instead of cast (PR #93749)

2024-05-29 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/93749 `Eval->Value.get` returns a null pointer when the variable doesn't have an initializer. This fixes https://github.com/llvm/llvm-project/issues/93625. rdar://128482541 >From 4648f46f5e15d5747596347feaef85069a8

[clang] Use cast_or_null instead of cast (PR #93749)

2024-05-29 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: Note that the call to `hasInit` at the beginning of function `VarDecl::getInit` returns true even when the variable doesn't have an initializer if `VarDecl::ensureEvaluatedStmt` is called before that. https://github.com/llvm/llvm-project/pull/93749 _

[clang] Use cast_or_null instead of cast (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/93749 >From 4648f46f5e15d5747596347feaef85069a8ce4df Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 29 May 2024 15:19:58 -0700 Subject: [PATCH 1/2] Use cast_or_null instead of cast `Eval->Value.get` returns

[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak edited https://github.com/llvm/llvm-project/pull/93749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/93749 >From 4648f46f5e15d5747596347feaef85069a8ce4df Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 29 May 2024 15:19:58 -0700 Subject: [PATCH 1/3] Use cast_or_null instead of cast `Eval->Value.get` returns

[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/93749 >From 4648f46f5e15d5747596347feaef85069a8ce4df Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 29 May 2024 15:19:58 -0700 Subject: [PATCH 1/3] Use cast_or_null instead of cast `Eval->Value.get` returns

[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: `hasInit` checks whether `VarDecl::Init`'s pointer is null. But `VarDecl::ensureEvaluatedStmt` creates an `EvaluatedStmt` if there isn't one already, after which `hasInit` returns true. https://github.com/llvm/llvm-project/blob/3af717d661e9fe8d562181b933a373ca58e41b27/clang/li

[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
ahatanak wrote: I can see if we can make `hasInit` check that too or rename the function after committing this patch. https://github.com/llvm/llvm-project/pull/93749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

2024-05-30 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak closed https://github.com/llvm/llvm-project/pull/93749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add arm64e ABI-defined key assignments to ptrauth.h. (PR #93901)

2024-05-30 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak approved this pull request. https://github.com/llvm/llvm-project/pull/93901 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/79230 >From 95200f3bb3859738981240a9d8c503a13ede9601 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 16 Jan 2024 13:18:09 -0800 Subject: [PATCH 01/12] Add support for builtin_verbose_trap The builtin causes

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread Akira Hatanaka via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( ahatanaka wrote: OK, I'll make it

[clang] Add support for builtin_verbose_trap (PR #79230)

2024-04-22 Thread Akira Hatanaka via cfe-commits
@@ -3424,6 +3445,26 @@ llvm::DIMacroFile *CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent, return DBuilder.createTempMacroFile(Parent, Line, FName); } +llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor( ahatanak wrote: @dwblaikie 's com

[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)

2024-07-23 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/100204 The builtin computes the discriminator for a type, which can be used to sign/authenticate function pointers and member function pointers. If the type passed to the builtin is a C++ member function pointer type

[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)

2024-07-23 Thread Akira Hatanaka via cfe-commits
@@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics %s + +// RUN: not %clang_cc1 -triple arm64-

[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)

2024-07-23 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/100204 >From 4cbbf9ee2c5afaa3818c10ab6f2645353da94a8c Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 23 Jul 2024 11:55:57 -0700 Subject: [PATCH 1/2] [PAC] Define __builtin_ptrauth_type_discriminator The bui

[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)

2024-07-23 Thread Akira Hatanaka via cfe-commits
@@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=1 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=2 +// RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %i

[clang] [PAC] Define __builtin_ptrauth_type_discriminator (PR #100204)

2024-07-23 Thread Akira Hatanaka via cfe-commits
@@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=1 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=2 +// RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %i

[clang] [lld] [llvm] [LTO] enable `ObjCARCContractPass` only on optimized build (PR #101114)

2024-07-30 Thread Akira Hatanaka via cfe-commits
@@ -588,12 +588,6 @@ bool EmitAssemblyHelper::AddEmitPasses(legacy::PassManager &CodeGenPasses, // this also adds codegenerator level optimization passes. CodeGenFileType CGFT = getCodeGenFileType(Action); - // Add ObjC ARC final-cleanup optimizations. This is done as pa

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -2373,7 +2373,9 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { DestLV.setTBAAInfo(TBAAAccessInfo::getMayAliasInfo()); return EmitLoadOfLValue(DestLV, CE->getExprLoc()); } -return Builder.CreateBitCast(Src, DstTy); + +llvm::Value *Result =

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { ahatanak wrote: I fixed the names of variables and functions add

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=NOPCH %s ahatanak wrote: Sorry, I just realized th

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -351,3 +434,125 @@ CodeGenModule::getVTablePointerAuthInfo(CodeGenFunction *CGF, /* IsIsaPointer */ false, /* AuthenticatesNullValues */ false, Discriminator); } + +llvm::Value *CodeGenFunction::AuthPointerToPointerCast(

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-16 Thread Akira Hatanaka via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- -fptrauth-function-pointer-type-discrimination | FileCheck %s ahatanak wrote: Thanks! Please add a line to test linux after this PR is merged

[clang] [Sema] Don't drop weak_import from a declaration that follows a declaration directly contained in a linkage-specification (PR #85886)

2024-07-17 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak updated https://github.com/llvm/llvm-project/pull/85886 >From d39667c7e65c10babb478d8f8d54fecb66d90568 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 19 Mar 2024 15:50:00 -0700 Subject: [PATCH 1/5] [Sema] Don't drop weak_import from a declaration that foll

[clang] [Sema] Don't drop weak_import from a declaration that follows a declaration directly contained in a linkage-specification (PR #85886)

2024-07-17 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak closed https://github.com/llvm/llvm-project/pull/85886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-18 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak closed https://github.com/llvm/llvm-project/pull/98847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Authenticate function pointers in UBSan type checks (PR #99590)

2024-07-18 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/99590 The function pointer needs to be authenticated before doing the type checks. >From c44fbc480f8632a178633637010ab6953ed3e50d Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Thu, 18 Jul 2024 16:54:09 -0700 Su

[clang] [PAC] Fix a crash when signing a pointer to a function with an incomplete enum parameter (PR #99595)

2024-07-18 Thread Akira Hatanaka via cfe-commits
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/99595 Use type int as the underlying type when the enum type is incomplete. >From 14612f84704edbcc3b3bcb20d6e114890e1c3998 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Thu, 18 Jul 2024 17:59:46 -0700 Subject:

<    4   5   6   7   8   9   10   11   >