diff options
author | JF Bastien <jfbastien@apple.com> | 2018-05-25 17:36:49 +0000 |
---|---|---|
committer | JF Bastien <jfbastien@apple.com> | 2018-05-25 17:36:49 +0000 |
commit | 7853d5faab9ba2c208b7042e076bc37398ed97aa (patch) | |
tree | e1716794aeaa50f5db928256908b338219fa91a1 /clang/lib | |
parent | 1c538423dc2482c475a00b0895dffde5a9ff9bd3 (diff) | |
download | bcm5719-llvm-7853d5faab9ba2c208b7042e076bc37398ed97aa.tar.gz bcm5719-llvm-7853d5faab9ba2c208b7042e076bc37398ed97aa.zip |
Follow-up fix for nonnull atomic non-member functions
Handling of the third parameter was only checking for *_n and not for the C11 variant, which means that cmpxchg of a 'desired' 0 value was erroneously warning. Handle C11 properly, and add extgensive tests for this as well as NULL pointers in a bunch of places.
Fixes r333246 from D47229.
llvm-svn: 333290
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 6f956b42f02..2f15c514dc1 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3519,8 +3519,8 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult, break; case 2: // The third argument to compare_exchange / GNU exchange is the desired - // value, either by-value (for the *_n variant) or as a pointer. - if (!IsN) + // value, either by-value (for the C11 and *_n variant) or as a pointer. + if (IsPassedByAddress) CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart()); Ty = ByValType; break; |