[PATCH] D126100: Add sanitizer-specific GlobalValue attributes.

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 14:35:59 PDT 2022


hctim added inline comments.


================
Comment at: llvm/include/llvm/AsmParser/LLToken.h:181
 #define GET_ATTR_NAMES
 #define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
   kw_##DISPLAY_NAME,
----------------
vitalybuka wrote:
> Have you considered in Attributes.inc ?
> 
> /// Can be used as global attribute.
> def GvAttr : AttrProperty;
I took a look at this, but adding GV support to Attributes.inc requires a lot more plumbing. There's bits to be added to Verifier.cpp, LLParser.cpp, LLLexer.cpp, Attributes.cpp, etc. I think it's better to leave that as a future refactoring exercise, along with the rest of the GV attributes.


================
Comment at: llvm/lib/IR/AsmWriter.cpp:3540
 
+  using SanitizerMetadata = llvm::GlobalValue::SanitizerMetadata;
+  if (GV->hasSanitizerMetadata()) {
----------------
vitalybuka wrote:
> AsmWriter/Parser should be tested in llvm-project/llvm/test/Assembler/
> e.g. Assembler/diglobalvariable.ll
/s/diglobalvariable/globalvariable-attributes, done

also tested in compatibility.ll


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126100



More information about the cfe-commits mailing list