Skip to content

Commit 3b9829e

Browse files
committed
Add "randomize_layout" attribute
1 parent 70d484d commit 3b9829e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/include/clang/Basic/Attr.td

+7
Original file line numberDiff line numberDiff line change
@@ -3186,3 +3186,10 @@ def ObjCExternallyRetained : InheritableAttr {
31863186
let Subjects = SubjectList<[NonParmVar, Function, Block, ObjCMethod]>;
31873187
let Documentation = [ObjCExternallyRetainedDocs];
31883188
}
3189+
3190+
def Randomized : InheritableAttr {
3191+
let Spellings = [GCC<"randomize_layout">, Declspec<"randomize_layout">,
3192+
Keyword<"randomize_layout">];
3193+
let Subjects = SubjectList<[Record]>;
3194+
let Documentation = [Undocumented];
3195+
}

clang/lib/Sema/SemaDeclAttr.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -6788,6 +6788,9 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
67886788
handleSimpleAttributeWithExclusions<NoSpeculativeLoadHardeningAttr,
67896789
SpeculativeLoadHardeningAttr>(S, D, AL);
67906790
break;
6791+
case ParsedAttr::AT_Randomized:
6792+
handleSimpleAttribute<RandomizedAttr>(S, D, AL);
6793+
break;
67916794
case ParsedAttr::AT_CodeSeg:
67926795
handleCodeSegAttr(S, D, AL);
67936796
break;

0 commit comments

Comments
 (0)