[PATCH] D108712: Avoid nullptr dereferencing of 'SubExpr'; NFC

2021-08-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

I've committed on your behalf in de15979bc32d761c9b5071fb7d28d7c04ebbfaf3 
, thank 
you for the improvement!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108712/new/

https://reviews.llvm.org/D108712

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108712: Avoid nullptr dereferencing of 'SubExpr'; NFC

2021-08-25 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir added a comment.

In D108712#2965433 , @aaron.ballman 
wrote:

> LGTM! There is no way for this to be null because `emitRethrow()` is what 
> should be called in that case.
>
> I'll land this on your behalf sometime shortly (perhaps as late as tomorrow).

Thank you, Aaron!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108712/new/

https://reviews.llvm.org/D108712

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108712: Avoid nullptr dereferencing of 'SubExpr'; NFC

2021-08-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM! There is no way for this to be null because `emitRethrow()` is what 
should be called in that case.

I'll land this on your behalf sometime shortly (perhaps as late as tomorrow).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108712/new/

https://reviews.llvm.org/D108712

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108712: Avoid nullptr dereferencing of 'SubExpr'; NFC

2021-08-25 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir created this revision.
schittir added reviewers: aaron.ballman, erichkeane.
schittir added a project: clang.
schittir requested review of this revision.
Herald added a subscriber: cfe-commits.

Avoid nullptr dereferencing of 'Constraint'; NFC

Klocwork static code analysis exposed this bug:
Pointer 'SubExpr' returned from call to getSubExpr() function 
which may return NULL from 'cast_or_null(Operand)', 
which will be dereferenced in the statement following it

Add an assert on SubExpr to avoid nullptr dereferencing


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108712

Files:
  clang/lib/CodeGen/MicrosoftCXXABI.cpp


Index: clang/lib/CodeGen/MicrosoftCXXABI.cpp
===
--- clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -4348,6 +4348,7 @@
 
 void MicrosoftCXXABI::emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) {
   const Expr *SubExpr = E->getSubExpr();
+  assert(SubExpr && "SubExpr cannot be null");
   QualType ThrowType = SubExpr->getType();
   // The exception object lives on the stack and it's address is passed to the
   // runtime function.


Index: clang/lib/CodeGen/MicrosoftCXXABI.cpp
===
--- clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -4348,6 +4348,7 @@
 
 void MicrosoftCXXABI::emitThrow(CodeGenFunction &CGF, const CXXThrowExpr *E) {
   const Expr *SubExpr = E->getSubExpr();
+  assert(SubExpr && "SubExpr cannot be null");
   QualType ThrowType = SubExpr->getType();
   // The exception object lives on the stack and it's address is passed to the
   // runtime function.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits