[PATCH] D54909: [clang][slh] add Clang attr no_speculative_load_hardening

Zola Bridges via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 14:05:59 PST 2018


zbrid marked an inline comment as done.
zbrid added inline comments.


================
Comment at: clang/test/SemaCXX/attr-speculative-load-hardening.cpp:19
 
+void f4() __attribute__((no_speculative_load_hardening, speculative_load_hardening)); // expected-error {{attributes are not compatible}}
+// expected-note at -1 {{conflicting attribute is here}}
----------------
zbrid wrote:
> > Should this situation be diagnosed?
> > 
> > __attribute__((no_speculative_load_hardening))
> > void func();
> > 
> > __attribute__((speculative_load_hardening))
> > void func();
> > Which attribute should "win"?
> > 
> > If you want to diagnose, you can use checkAttrMutualExclusion() to handle this in SemaDeclAttr.cpp.
> >
> 
> @aaron.ballman 
> That's a great idea. So far I've added the use of checkAttrMutualExclusion which catches the cases in this test and the three added below. I'm working on a change that will catch the case in your example. I think I'll have to make a change in Clang to check for mutual exclusion when the attributes are merged rather than where they are currently checked. I don't have all the details yet, but I think I'll send a separate patch for that once I figure out what's going on.
> 
> 
After looking more closely at this, I think I only need to write a function for this particular attribute to be merged differently than the default way which will cause the diagnostic if necessary in this case which is a smaller change than I thought, so I'll add the change to this patch.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54909





More information about the llvm-commits mailing list