[PATCH] D54555: [clang][slh] add attribute for speculative load hardening

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 20 13:07:55 PST 2018


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:3092
+  let Spellings = [Clang<"speculative_load_hardening">];
+  let Subjects = SubjectList<[Function], ErrorDiag>;
+  let Documentation = [SpeculativeLoadHardeningDocs];
----------------
zbrid wrote:
> aaron.ballman wrote:
> > On reflection, I think this could make sense being applied to Obj-C methods as well, correct?
> I don't know much about Objective C, but maybe we can work out whether this makes sense to use with Objective C together. There is a Subject called ObjCMethod which I could add as a subject. Assuming this will add speculative_load_hardening to the LLVM IR for Objective C in the same way this happens for C/C++, then do you know if there'd be any issue with that LLVM IR attribute being compatible with any Objective C specific middle end or back end passes/code? Off the top of my head, I think it would be fine, but I'm new to LLVM hacking, so I may have missed something. 
I think you can get away with adding `ObjCMethod` to the subject list (updating the docs), and adding a new test with a .m extension that adds the attribute to an Objective-C method declaration and checks that the IR sees the attribute has been lowered. e.g.,
```
@interface SimpleClass
- (void)someMethod __attribute__((speculative_load_hardening));
@end
```


Repository:
  rL LLVM

https://reviews.llvm.org/D54555





More information about the llvm-commits mailing list