Skip to content

Commit e9aaaf5

Browse files
committed
Use correct preferred type and fix the attribute documentation.
1 parent f4a54d9 commit e9aaaf5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

clang/include/clang/AST/Type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,7 +4704,7 @@ class FunctionType : public Type {
47044704
struct alignas(void *) FunctionTypeArmAttributes {
47054705
/// Any AArch64 SME ACLE type attributes that need to be propagated
47064706
/// on declarations and function pointers.
4707-
LLVM_PREFERRED_TYPE(uint16_t)
4707+
LLVM_PREFERRED_TYPE(AArch64SMETypeAttributes)
47084708
unsigned AArch64SMEAttributes : 9;
47094709

47104710
FunctionTypeArmAttributes() : AArch64SMEAttributes(SME_NormalFunction) {}
@@ -5290,7 +5290,7 @@ class FunctionProtoType final
52905290
unsigned HasTrailingReturn : 1;
52915291
LLVM_PREFERRED_TYPE(bool)
52925292
unsigned CFIUncheckedCallee : 1;
5293-
LLVM_PREFERRED_TYPE(uint16_t)
5293+
LLVM_PREFERRED_TYPE(AArch64SMETypeAttributes)
52945294
unsigned AArch64SMEAttributes : 9;
52955295

52965296
ExtProtoInfo()

clang/include/clang/Basic/AttrDocs.td

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,6 +3645,8 @@ make the function's CFI jump table canonical. See :ref:`the CFI documentation
36453645

36463646
def KCFISaltDocs : Documentation {
36473647
let Category = DocCatFunction;
3648+
let Heading = "kcfi_salt";
3649+
let Label = "langext-kcfi_salt";
36483650
let Content = [{
36493651
Use ``__attribute__((kcfi_salt("<salt>")))`` on a function declaration, function
36503652
definition, or typedef to help distinguish CFI hashes between functions with
@@ -3655,7 +3657,7 @@ Example use:
36553657
.. code-block:: c
36563658

36573659
// .h file:
3658-
#define __kcfi_salt __attribute__((kcfi_salt("vogon")))
3660+
#define __kcfi_salt __attribute__((kcfi_salt("pepper")))
36593661

36603662
// Convenient typedefs to avoid nested declarator syntax.
36613663
typedef int (*fptr_t)(void); // Non-salted function call.
@@ -3676,26 +3678,26 @@ Example use:
36763678
.init = internal_init,
36773679
.exec = internal_salted_exec,
36783680
.teardown = internal_teardown,
3679-
}
3681+
};
36803682

3681-
struct widget_generator *widget_gen = _generator;
3683+
struct widget_generator *widget_gen = &_generator;
36823684

36833685
// 2nd .c file:
36843686
int generate_a_widget(void) {
36853687
int ret;
36863688

36873689
// Called with non-salted CFI.
3688-
ret = widget_gen.init();
3690+
ret = widget_gen->init();
36893691
if (ret)
36903692
return ret;
36913693

36923694
// Called with salted CFI.
3693-
ret = widget_gen.exec();
3695+
ret = widget_gen->exec();
36943696
if (ret)
36953697
return ret;
36963698

36973699
// Called with non-salted CFI.
3698-
return widget_gen.teardown();
3700+
return widget_gen->teardown();
36993701
}
37003702

37013703
}];

0 commit comments

Comments
 (0)