[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/Sema/SemaExpr.cpp:16218 +checkNonTrivialCUnion(E->getType(), E->getExprLoc(), + Sema::NTCUC_LValueToRValueVolatile); + rjmccall wrote: > ahatan

[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/Sema/SemaExpr.cpp:16218 +checkNonTrivialCUnion(E->getType(), E->getExprLoc(), + Sema::NTCUC_LValueToRValueVolatile); + ahatanak wrote: > rjmcca

[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: include/clang/AST/Type.h:1133 + /// Check if this is or contains a non-trivial C struct/union type. + bool hasNonTrivialPrimitiveCStruct() const; rjmccall wrote: > You only

[PATCH] D62645: [Sema] Resolve placeholder types before type deduction to silence spurious `-Warc-repeated-use-of-weak` warnings

2019-07-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 207931. ahatanak marked 2 inline comments as done. ahatanak added a comment. Add an implicit-only attribute `ObjCDefaultedAnyToId` to avoid passing the flag down. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62645/new/ htt

[PATCH] D62645: [Sema] Resolve placeholder types before type deduction to silence spurious `-Warc-repeated-use-of-weak` warnings

2019-07-08 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. ahatanak marked an inline comment as done. Closed by commit rL365382: [Sema] Resolve placeholder types before type deduction to silence (authored by ahatanak, committed by ). Herald added a project: LLVM. Herald added a subs

[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 208861. ahatanak marked 2 inline comments as done. ahatanak added a comment. Add a bit to `RecordDeclBitfields` that indicates whether the record has a non-trivial C union member. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org

[PATCH] D64464: [CodeGen] Emit destructor calls for non-trivial C structs

2019-07-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous. This patch fixes a bug in IRGen where it wasn't calling the destructors for non-trivial C structs in the following cases: - member access of struct

[PATCH] D64464: [CodeGen] Emit destructor calls for non-trivial C structs

2019-07-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/CodeGen/CGExprAgg.cpp:248 bool RequiresDestruction = - Dest.isIgnored() && + !Dest.isExternallyDestructed() && RetTy.isDestructedType() == QualType::DK_nontrivial_c_stru

[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked 3 inline comments as done. ahatanak added inline comments. Comment at: lib/Sema/SemaExpr.cpp:6097 + // non-trivial to copy or default-initialize. + checkNonTrivialCUnionInInitList(ILE); + } rjmccall wrote: > Can we extract a common func

[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 209108. ahatanak marked 3 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63753/new/ https://reviews.llvm.org/D63753 Files: include/clang/AST/Decl.

[PATCH] D63753: [Sema] Instead of rejecting C unions with non-trivial fields, detect attempts to destruct/initialize/copy them.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked 2 inline comments as done. ahatanak added inline comments. Comment at: lib/Sema/SemaDecl.cpp:12053 +NTCUC_UninitAutoVar); } + rjmccall wrote: > Please add a comment explaining why this is specific to local variable

[PATCH] D64526: [NFC] Unforget a colon in a few CHECK: directives.

2019-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. I didn't know spaces are not allowed between "CHECK" and ":". CodeGen tests LGTM. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64526/new/ https://reviews.llvm.org/D64526 ___ cfe-commits mai

[PATCH] D61667: Assume `__cxa_allocate_exception` returns an under-aligned memory on Darwin if the version of libc++abi isn't new enough to include the fix in r319123

2019-05-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 198939. ahatanak marked 6 inline comments as done. ahatanak added a comment. Herald added a subscriber: aheejin. Address review comments. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61667/new/ https://reviews.llvm.org/D616

[PATCH] D61667: Assume `__cxa_allocate_exception` returns an under-aligned memory on Darwin if the version of libc++abi isn't new enough to include the fix in r319123

2019-05-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/Basic/TargetInfo.h:643 + /// runtime, such as those using the Itanium C++ ABI. + virtual unsigned getExnObjectAlignment() const { +// Itanium says that an _Unwind_Exception has to be "double-word" rj

[PATCH] D61667: Assume `__cxa_allocate_exception` returns an under-aligned memory on Darwin if the version of libc++abi isn't new enough to include the fix in r319123

2019-05-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 198959. ahatanak added a comment. Update the comment in `CheckCXXThrowOperand`. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61667/new/ https://reviews.llvm.org/D61667 Files: include/clang/AST/ASTContext.h include/clan

[PATCH] D61667: Assume `__cxa_allocate_exception` returns an under-aligned memory on Darwin if the version of libc++abi isn't new enough to include the fix in r319123

2019-05-09 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC360404: Assume `__cxa_allocate_exception` returns an under-aligned memory on (authored by ahatanak, committed by ). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61667/new/

[PATCH] D61803: [CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when necessary.

2019-05-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: pete, rjmccall. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous. Prior to r349952, clang used to call `objc_msgSend` when sending a release messages, emitting an invoke instruction instead of a call instructi

[PATCH] D61803: [CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when necessary.

2019-05-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 199081. ahatanak marked an inline comment as done. ahatanak added a comment. Just call `EmitCallOrInvoke`. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61803/new/ https://reviews.llvm.org/D61803 Files: lib/CodeGen/CGObjC

[PATCH] D61803: [CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when necessary.

2019-05-10 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL360474: [CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when (authored by ahatanak, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior

[PATCH] D61957: [CodeGenObjC] invoke objc_autorelease, objc_retain when necessary

2019-05-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak accepted this revision. ahatanak added a comment. This revision is now accepted and ready to land. LGTM Comment at: clang/test/CodeGenObjC/convert-messages-to-runtime-calls.m:208 + } +} Can you add tests for `objc_alloc`, `objc_allocWithZone` and `obj

[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

2019-05-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: pete, rjmccall, erik.pilkington. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous. This patch makes IRGen emit ObjC runtime functions (`objc_autoreleaseReturnValue` and `objc_retainAutoreleasedReturnValue`) th

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, theraven. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous. clang currently emits different strings for `s0` and `s1` in the following code because pointers to typedefs are encoded as "^{PointeeClass

[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

2019-05-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 199760. ahatanak marked an inline comment as done. ahatanak added a comment. Run the main ARC optimization passes when `ObjCNoBuiltinRetainRelease` is not set. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61970/new/ https:

[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

2019-05-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/CodeGenObjC/convert-messages-to-runtime-calls.m:32 // CALLS: {{call.*@objc_allocWithZone}} - // CALLS: {{call.*@objc_retain}} + // CALLS-ARC-INTRINSICS: {{call.*@llvm.objc.retainAutoreleasedReturnValue}} + // CALLS-NO-ARC-INT

[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

2019-05-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/CodeGen/CGObjC.cpp:2611 + if (!CGM.getCodeGenOpts().ObjCNoBuiltinRetainRelease && !getInvokeDest()) +return EmitARCRetainAutoreleasedReturnValue(value, returnType); return emitObjCV

[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

2019-05-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/CodeGen/CGObjC.cpp:2611 + if (!CGM.getCodeGenOpts().ObjCNoBuiltinRetainRelease && !getInvokeDest()) +return EmitARCRetainAutoreleasedReturnValue(value, returnType); return emitObjCV

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/AST/ASTContext.cpp:6973 QualType PointeeTy = OPT->getPointeeType(); -if (!Options.EncodingProperty() && +if (getLangOpts().ObjCRuntime.isGNUFamily() && +!Options.Encodi

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 200216. ahatanak marked an inline comment as done. ahatanak added a comment. Delete the entire code path that tries to work around a bug in gcc. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61974/new/ https://reviews.llvm.o

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Yes, I think we can add something to the release note. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61974/new/ https://reviews.llvm.org/D61974 ___ cfe-commits mailing list cfe-commits@lists

[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

2019-05-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak abandoned this revision. ahatanak added a comment. This isn't the right way to make a call to `objc_autorelease` a tail call, so I'm closing this for now. If we decide to convert calls to `objc_autorelease` and `objc_retain` to calls to `objc_autoreleaseReturnValue` and `objc_retainAut

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-28 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61974/new/ https://reviews.llvm.org/D61974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-28 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 201760. ahatanak marked an inline comment as done. ahatanak added a comment. Remove flag `EncodePointerToObjCTypedef`, which is no longer needed. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61974/new/ https://reviews.llvm.

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-29 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC362034: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs (authored by ahatanak, committed by ). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61974/n

[PATCH] D61974: [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

2019-05-29 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In D61974#1521334 , @theraven wrote: > LGTM. I wonder if we have any other ugly GCC bug compatibility parts in > clang's Objective-C implementation... I see a couple of FIXME comments in ASTContext.cpp that seem to suggest cla

[PATCH] D55659: [Sema][ObjC] Disallow non-trivial C struct fields in unions

2018-12-13 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous. This patch fixes a bug where clang doesn’t reject union fields of non-trivial struct types: struct S0 { id x; }; struct S1 { id y;

[PATCH] D55659: [Sema][ObjC] Disallow non-trivial C struct fields in unions

2018-12-13 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Just to clarify, this patch doesn't change clang's handling of C++ unions that have non-static data members with non-trivial special member functions. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55659/new/ https://reviews.llvm.org/D55

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-13 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: erik.pilkington, rjmccall, rsmith. ahatanak added a project: clang. Herald added subscribers: dexonsmith, jkorous. Sema shouldn't record uses of weak variables when they are used in an unevaluated context. For example: decltype([obj we

[PATCH] D55544: Warning: objc-encodings-larger-than=

2018-12-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. The patch looks largely fine to me. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6207 +def warn_objc_method_encoding_too_large : Warning< + "%0 method %1 encoding of size %2 is larger than %3 bytes">, + InGroup; You can use

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 178341. ahatanak added a comment. Call CheckPlaceholderExpr instead of pushing an unevaluated evaluation context. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55662/new/ https://reviews.llvm.org/D55662 Files: lib/Sema/Se

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/Sema/SemaType.cpp:8127 QualType Sema::BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated) { ExprResult ER = CheckPlaceholderExpr(E); ---

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-18 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Here are a couple of examples I found running the regression tests: int f0(int); float f0(float); decltype(f0) f0_a; // this is not valid. template int var_expr(Ts... ts); template auto a_function(Ts... ts) -> decltype(var_expr(ts...)); templat

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-18 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Sorry, please ignore my previous comment. I was looking at the wrong place. The following code reaches `Sema::BuildDecltypeType` without going through `ActOnDecltypeExpression`: template void overloaded_fn(T); decltype(auto) v5 = &overloaded_fn; `Sema::BuildDec

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 178957. ahatanak added a comment. Remove the call to `CheckPlaceholderExpr` in `Sema::BuildDecltypeType` and move it to `Sema::DeduceAutoType`. Assert that the expression that is passed to `Sema::BuildDecltypeType` isn't a placeholder. Repository: rC Cl

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In D55662#1335773 , @rjmccall wrote: > Okay. You may need to push an unevaluated context when doing that. Since I'm just moving the call to `CheckPlaceholderExpr` to the call site, I don't think I have to push an unevaluated c

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-12-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 179195. ahatanak marked 2 inline comments as done. ahatanak added a comment. Check whether the declaration passed to Sema::CanUseDecl is an aligned allocation/deallocation function that is unavailable. Repository: rC Clang CHANGES SINCE LAST ACTION ht

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2018-12-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In D55662#1337141 , @rjmccall wrote: > In D55662#1336835 , @ahatanak wrote: > > > In D55662#1335773 , @rjmccall > > wrote: > > > > > Okay. You may

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-12-20 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL349890: [Sema] Produce diagnostics when C++17 aligned allocation/deallocation (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llv

[PATCH] D54539: [CodeGen] Replace '@' characters in block descriptors' symbol names with '\1' on ELF targets.

2018-12-29 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 179676. ahatanak added a comment. Sorry for the delay. The updated patch replaces '@' with '\1' on all targets. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54539/new/ https://reviews.llvm.org/D54539 Files: lib/CodeGen/C

[PATCH] D54539: [CodeGen] Replace '@' characters in block descriptors' symbol names with '\1' on ELF targets.

2018-12-29 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL350157: [CodeGen] Replace '@' characters in block descriptors' symbol names with (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2019-01-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 180186. ahatanak marked an inline comment as done. ahatanak added a comment. Do not record use of weak variables when the type of an auto variable is being deduced. I'm not sure creating an RAII class is the best way to silence the warning, but I haven't b

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2019-01-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In D55662#1346055 , @rjmccall wrote: > I think you could just disable the diagnostic in an unevaluated context. The call to `isUnevaluatedContext` in `ObjCPropertyOpBuilder::complete` returns false when the type of `auto __weak

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2019-01-04 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In D55662#1346077 , @rjmccall wrote: > Hmm. Are we resolving the placeholder expression twice here? That might be > the basic problem. Yes, `CheckPlaceholderExpr` is called in `Sema::DeduceAutoType` to deduce the type of the

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2019-01-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. We can make `DeduceVariableDeclarationType` return the rewritten expression and replace `Init` in `Sema::AddInitializerToDecl` with it. Alternatively, we can keep a set of `ObjCPropertyRefExpr`s passed to `recordUseOfWeak` (the original `ObjCPropertyRefExpr`, if it was

[PATCH] D55662: [Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context.

2019-01-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 180593. ahatanak added a comment. Make `deduceVarTypeFromInitializer` and `DeduceVariableDeclarationType` return the new initialization expression and use it in `Sema::AddInitializerToDecl`. Add a test case that tests lambda capture with an initializer. R

[PATCH] D56445: [Sema] Teach Clang that aligned allocation is not supported with macosx10.13

2019-01-08 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak accepted this revision. ahatanak added a comment. This revision is now accepted and ready to land. LGTM. We should probably check that alignedAllocMinVersion returns the correct versions for other OSes too, but this patch is fine. Repository: rC Clang CHANGES SINCE LAST ACTION ht

[PATCH] D55662: [Sema] If CheckPlaceholderExpr rewrites a placeholder expression when the type of an auto variable is being deduced, use the rewritten expression when performing initialization of the

2019-01-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 180993. ahatanak retitled this revision from "[Sema][ObjC] Do not warn about repeated uses of weak variables when the variables are accessed in an unevaluated context." to "[Sema] If CheckPlaceholderExpr rewrites a placeholder expression when the type of an

[PATCH] D55662: [Sema] If CheckPlaceholderExpr rewrites a placeholder expression when the type of an auto variable is being deduced, use the rewritten expression when performing initialization of the

2019-01-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added a comment. In D55662#1349329 , @rjmccall wrote: > Oh, and please update the commit message to primarily talk about the changes > to placeholder checking. You can discuss the impact on the > repea

[PATCH] D55662: [Sema] If CheckPlaceholderExpr rewrites a placeholder expression when the type of an auto variable is being deduced, use the rewritten expression when performing initialization of the

2019-01-10 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL350887: [Sema] Call CheckPlaceholderExpr to resolve typeof or decltype (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D

[PATCH] D45578: Add a command line option 'fregister_dtor_with_atexit' to register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit.

2018-04-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: arphaman, steven_wu, rjmccall. The command line option makes IRGen register destructor functions annotated with __attribute__((destructor)) calling __cxa_atexit in a synthesized constructor function instead of emitting references to the des

[PATCH] D45578: Add a command line option 'fregister_dtor_with_atexit' to register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit.

2018-04-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142218. ahatanak edited the summary of this revision. ahatanak added a comment. Fix an error in emitGlobalDtorWithCXAAtExit and make sure @dso_handle is hidden. Repository: rC Clang https://reviews.llvm.org/D45578 Files: include/clang/Driver/Options.t

[PATCH] D45578: Add a command line option `fregister_global_dtors_with_atexit` to register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit.

2018-04-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142597. ahatanak marked 4 inline comments as done. ahatanak retitled this revision from "Add a command line option 'fregister_dtor_with_atexit' to register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit."

[PATCH] D45578: Add a command line option `fregister_global_dtors_with_atexit` to register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit.

2018-04-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/Driver/Options.td:1613 +def fregister_dtor_with_atexit : Flag<["-"], "fregister-dtor-with-atexit">, Group, Flags<[CC1Option]>, + HelpText<"Use atexit or __cxa_atexit to register destructors">; def fuse_init_array : Flag

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142691. ahatanak marked an inline comment as done. ahatanak added a comment. Move method visitArray to the derived classes and pass the array type to the method instead of the QualType. Repository: rC Clang https://reviews.llvm.org/D45310 Files: incl

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/AST/NonTrivialCStructTypeVisitor.h:30 +if (asDerived().getContext().getAsArrayType(FT)) + return asDerived().visitArray(DK, FT, std::forward(Args)...); + rjmccall wrote: > ahatanak wrote: > > rjmc

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142705. ahatanak marked an inline comment as done. ahatanak added a comment. Fix indentation. Repository: rC Clang https://reviews.llvm.org/D45310 Files: include/clang/AST/NonTrivialTypeVisitor.h include/clang/Basic/DiagnosticSemaKinds.td lib/Code

[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-17 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 142792. ahatanak added a comment. Deactivate the cleanups for callee-destructed parameters that are being forwarded to a delegated constructor. I also added a new member (CurrentCleanupStackDepth) to CodeGenFunction that tracks the stack depth of the most

[PATCH] D45578: Add a command line option `fregister_global_dtors_with_atexit` to register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit.

2018-04-17 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL330199: Add a command line option 'fregister_global_dtors_with_atexit' to (authored by ahatanak, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.o

[PATCH] D45310: Warn about memcpy'ing non-trivial C structs

2018-04-17 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC330202: [Sema] Warn about memcpy'ing non-trivial C structs. (authored by ahatanak, committed by ). Changed prior to commit: https://reviews.llvm.org/D45310?vs=142705&id=142815#toc Repository: rC Clan

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-04-20 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rsmith, rjmccall. If an initializer in a braced-init-list is a C++ class that has a non-trivial destructor, mark the destructor as referenced. This fixes a crash in CodeGenFunction::destroyCXXObject that occurs when it tries to emit a cal

[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 143624. ahatanak marked 2 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D45382 Files: lib/CodeGen/CGCall.cpp lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGDecl.cpp lib/CodeGen

[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. x. Comment at: lib/CodeGen/CGCall.cpp:3069 + if (hasAggregateEvaluationKind(type) && + getContext().isParamDestroyedInCallee(type)) { +EHScopeStack::stable_iterator cleanup = rjmccall wrote: > I wonder if this is something we

[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-26 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 144231. ahatanak marked an inline comment as done. ahatanak added a comment. Rename variable to something OldCleanupScopeDepth. Repository: rC Clang https://reviews.llvm.org/D45382 Files: lib/CodeGen/CGCall.cpp lib/CodeGen/CGCleanup.cpp lib/CodeGe

[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

2018-04-26 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC331016: [CodeGen] Avoid destructing a callee-destructued struct type in a (authored by ahatanak, committed by ). Repository: rC Clang https://reviews.llvm.org/D45382 Files: lib/CodeGen/CGCall.cpp

[PATCH] D46042: Cap vector alignment at 16 for all Darwin platforms

2018-05-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak accepted this revision. ahatanak added a comment. This revision is now accepted and ready to land. LGTM Repository: rC Clang https://reviews.llvm.org/D46042 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cg

[PATCH] D46042: Cap vector alignment at 16 for all Darwin platforms

2018-05-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. > Note that this sort of attribute is stripped from template arguments in > template substitution, so there's a possibility that code templated over > vectors will produce inadequately-aligned objects. I was wondering whether there is a warning clang issues when the al

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a reviewer: jlebar. ahatanak added a subscriber: jlebar. ahatanak added a comment. ping. @jlebar, is the change I made to call-host-fn-from-device.cu correct? Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits ma

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. The original comment said "call sized device delete even though host has preferable non-sized version", but it seems that the non-sized host version 'T::operator delete(void*)' is being called in the IR, not the sized device version of delete. Is that a bug in overload

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. I mean ToT clang (without my patch applied) seems to select the non-sized host version 'T::operator delete(void*)'. Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llv

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Yes, that is the case. It doesn't change overloading resolution, it is just producing a diagnostic. Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lis

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-07-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 153779. ahatanak added a comment. Herald added a subscriber: dexonsmith. Implement the new rule defined here: http://wg21.link/p0968r0#2227. Produce a diagnostic if a class is initialized with aggregate initialization and one of its element's destructor is

[PATCH] D49119: [Sema][ObjC] Issue a warning when a method declared in a protocol is non-escaping but the corresponding method in the implementation is escaping.

2018-07-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: arphaman, vsapsai, dcoughlin. ahatanak added a project: clang. Herald added a subscriber: dexonsmith. This patch makes Sema issue a warning when there is an extension that conforms to a protocol that declares a non-escaping method and the

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-07-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Herald added a subscriber: dexonsmith. ping Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D22391: [Sema] Add warning for implicitly casting a null constant to a non null pointer type

2018-07-09 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Herald added a subscriber: dexonsmith. ping Repository: rC Clang https://reviews.llvm.org/D22391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D22391: [Sema] Add warning for implicitly casting a null constant to a non null pointer type

2018-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 154908. ahatanak marked 3 inline comments as done. ahatanak added a comment. Address review comments. Repository: rC Clang https://reviews.llvm.org/D22391 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td in

[PATCH] D22391: [Sema] Add warning for implicitly casting a null constant to a non null pointer type

2018-07-10 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/Sema/SemaExpr.cpp:11103 + if (const auto *DeclRef = dyn_cast(LHSExpr)) +checkNullConstantToNonNull(DeclRef->getType(), RHS.get()); jordan_rose wrote: > This could come later, but what about struct members or

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-07-11 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang https://reviews.llvm.org/D45898 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D49303: [CodeGen][ObjC] Treat non-escaping blocks as global blocks to make copy/dispose a no-op

2018-07-13 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added a reviewer: rjmccall. Herald added a subscriber: dexonsmith. Copying or disposing of a non-escaping block can be a no-op. A non-escaping block on the stack doesn't have to be copied to the heap as we know it won't be called after its lifetime ends.

[PATCH] D22391: [Sema] Add warning for implicitly casting a null constant to a non null pointer type

2018-07-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/Sema/conditional-expr.c:20 vp = 0 ? (double *)0 : (void *)0; - ip = 0 ? (double *)0 : (void *)0; // expected-warning {{incompatible pointer types assigning to 'int *' from 'double *'}} + ip = 0 ? (double *)0 : (void *)0; // e

[PATCH] D47757: [Sema] Produce diagnostics when unavailable aligned allocation/deallocation functions are called

2018-07-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang https://reviews.llvm.org/D47757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D49303: [CodeGen][ObjC] Treat non-escaping blocks as global blocks to make copy/dispose a no-op

2018-07-18 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak planned changes to this revision. ahatanak added a comment. In https://reviews.llvm.org/D49303#1165902, @rjmccall wrote: > Please test that we still copy captures correctly into the block object and > destroy them when the block object is destroyed. There is a bug in my patch where th

[PATCH] D45898: [SemaCXX] Mark destructor as referenced

2018-07-18 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. ping Repository: rC Clang https://reviews.llvm.org/D45898 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D60108: [os_log] Mark os_log_helper `nounwind`

2020-05-29 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/CodeGenObjCXX/os_log.mm:3 +// RUN: -fexceptions -fcxx-exceptions -O1 | FileCheck %s + +// Check that no EH cleanup is emitted around the call to __os_log_helper. Sorry for the late feedback. Can we pass `-O0` in

[PATCH] D83997: [os_log] Improve the way we extend the lifetime of objects passed to __builtin_os_log_format

2020-07-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, erik.pilkington. ahatanak added a project: clang. Herald added subscribers: ributzka, dexonsmith, jkorous, martong. Herald added a reviewer: shafik. This patch fixes several shortcomings of the way we currently extend the lifetim

[PATCH] D83997: [os_log] Improve the way we extend the lifetime of objects passed to __builtin_os_log_format

2020-07-23 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. The use case for this is a macro in which the call to `__builtin_os_log_format` that writes to the buffer and the call that uses the buffer appear in two different statements. For example: __builtin_os_log_format(buf, "%@", getObj()); ... use_buffer(buf); The ob

[PATCH] D84540: [CodeGen][ObjC] Mark calls to objc_unsafeClaimAutoreleasedReturnValue as notail on x86-64

2020-07-24 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, erik.pilkington. ahatanak added a project: clang. Herald added subscribers: ributzka, dexonsmith, jkorous. This is needed because the epilogue code inserted before tail calls on x86-64 breaks the handshake between the caller and

[PATCH] D76782: [CodeGenObjC] Fix a crash when attempting to copy a zero-sized bit-field in a non-trivial C struct

2020-04-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. Thanks for fixing this! Comment at: clang/lib/CodeGen/CGNonTrivialStruct.cpp:545 LValue DstLV, SrcLV; if (FD) { + // No need to copy zero-length bit-fields. Can you add the same check to `GenBinaryFuncName::visitVolatile

[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. I'm not sure which part I'm supposed to look at, but the changes LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76572/new/ https://reviews.llvm.org/D76572 ___ cfe-commits

[PATCH] D76782: [CodeGenObjC] Fix a crash when attempting to copy a zero-sized bit-field in a non-trivial C struct

2020-04-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak accepted this revision. ahatanak added a comment. This revision is now accepted and ready to land. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76782/new/ https://reviews.llvm.org/D76782 ___ cfe-commits mailing list cfe-commi

[PATCH] D78134: [Sema] Don't apply an lvalue-to-rvalue conversion to a discarded-value expression if it has an array type

2020-04-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: efriedma, rsmith, rjmccall. ahatanak added a project: clang. Herald added subscribers: ributzka, dexonsmith, jkorous. This fixes a bug which causes clang to emit incorrect IR for the following code in C++: int foo(void) { unsigned a

[PATCH] D78134: [Sema] Don't apply an lvalue-to-rvalue conversion to a discarded-value expression if it has an array type

2020-04-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. My first patch just did that and it seems to work. But the comment for `DefaultLvalueConversion` says "This is DefaultFunctionArrayLvalueConversion, except that it assumes the operand isn't of function or array type". It doesn't even have assertions to check that thoug

<    1   2   3   4   5   6   7   8   9   10   >