[PATCH] D17993: [CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer arguments.
    Alexander Richardson via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Tue Nov 17 14:51:12 PST 2020
    
    
  
arichardson added inline comments.
================
Comment at: clang/lib/CodeGen/CGCall.cpp:2169
+    if (!CodeGenOpts.NullPointerIsValid &&
+        getContext().getTargetAddressSpace(FI.arg_begin()->type) == 0) {
+      Attrs.addAttribute(llvm::Attribute::NonNull);
----------------
Isn't the `this` pointer also nonnull in other address spaces?
In our CHERI fork we use AS200 for the this pointer and would quite like to have the nonnull attribute.
I can obviously change this line locally when I next merge from upstream, but I would like to avoid diffs and it seems to me like this restriction is unnecessary.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D17993/new/
https://reviews.llvm.org/D17993
    
    
More information about the cfe-commits
mailing list