[PATCH] D158984: [Clang] Allow __declspec(noalias) to access inaccessible memory

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 02:44:17 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG14cc7a077275: [Clang] Allow __declspec(noalias) to access inaccessible memory (authored by nikic).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158984

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGen/ms-declspecs.c


Index: clang/test/CodeGen/ms-declspecs.c
===================================================================
--- clang/test/CodeGen/ms-declspecs.c
+++ clang/test/CodeGen/ms-declspecs.c
@@ -41,4 +41,4 @@
 // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
 // CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
 // CHECK: attributes [[NR]] = { noreturn }
-// CHECK: attributes [[NA]] = { nounwind memory(argmem: readwrite){{.*}} }
+// CHECK: attributes [[NA]] = { nounwind memory(argmem: readwrite, inaccessiblemem: readwrite){{.*}} }
Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2375,7 +2375,7 @@
       // gcc specifies that 'pure' functions cannot have infinite loops.
       FuncAttrs.addAttribute(llvm::Attribute::WillReturn);
     } else if (TargetDecl->hasAttr<NoAliasAttr>()) {
-      FuncAttrs.addMemoryAttr(llvm::MemoryEffects::argMemOnly());
+      FuncAttrs.addMemoryAttr(llvm::MemoryEffects::inaccessibleOrArgMemOnly());
       FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
     }
     if (TargetDecl->hasAttr<RestrictAttr>())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158984.554229.patch
Type: text/x-patch
Size: 1176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230829/41a3e291/attachment-0001.bin>


More information about the cfe-commits mailing list