File tree 2 files changed +37
-0
lines changed 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -3865,6 +3865,21 @@ QualType ASTContext::mergeBoundsSafetyPointerTypes(
3865
3865
if (OrigDstTy.isNull())
3866
3866
OrigDstTy = DstTy;
3867
3867
3868
+ // An ugly way to keep va_list typedef in DstTy if the merge type doesn't
3869
+ // change.
3870
+ // TODO: We need a general way of not stripping sugars.
3871
+ QualType DesugaredDstTy;
3872
+ if (const auto *TDT = dyn_cast<TypedefType>(DstTy))
3873
+ DesugaredDstTy = TDT->desugar();
3874
+ else if (const auto *ET = dyn_cast<ElaboratedType>(DstTy))
3875
+ DesugaredDstTy = ET->desugar();
3876
+ if (!DesugaredDstTy.isNull()) {
3877
+ QualType MergeTy = mergeBoundsSafetyPointerTypes(DesugaredDstTy, SrcTy,
3878
+ MergeFunctor, OrigDstTy);
3879
+ if (MergeTy == DesugaredDstTy)
3880
+ return DstTy;
3881
+ }
3882
+
3868
3883
// FIXME: a brittle hack to avoid skipping ValueTerminatedType outside
3869
3884
// this PtrAutoAttr AttributedType.
3870
3885
bool RecoverPtrAuto = false;
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fbounds-safety -ast-dump %s 2>&1 | FileCheck %s
2
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fbounds-safety -x c++ -fexperimental-bounds-safety-cxx -ast-dump %s 2>&1 | FileCheck %s
3
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fbounds-safety -x objective-c -fexperimental-bounds-safety-objc -ast-dump %s 2>&1 | FileCheck %s
4
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fexperimental-bounds-safety-attributes -x c -ast-dump %s 2>&1 | FileCheck %s
5
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fexperimental-bounds-safety-attributes -x c++ -ast-dump %s 2>&1 | FileCheck %s
6
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fexperimental-bounds-safety-attributes -x objective-c -ast-dump %s 2>&1 | FileCheck %s
7
+ // RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -fexperimental-bounds-safety-attributes -x objective-c++ -ast-dump %s 2>&1 | FileCheck %s
8
+
9
+ #include <ptrcheck.h>
10
+ #include <stdarg.h>
11
+ #include <stddef.h>
12
+
13
+ #define __printf (string_index , first_to_check ) \
14
+ __attribute__((__format__(__printf__, string_index, first_to_check)))
15
+
16
+ #ifndef __cplusplus
17
+ #define __restrict restrict
18
+ #endif
19
+
20
+ // CHECK: ParmVarDecl {{.+}} foo_args 'va_list':'char *'
21
+ int vsnprintf (char * __restrict __counted_by (__size ) __str , size_t __size ,
22
+ const char * __restrict __format , va_list foo_args ) __printf (3 , 0 );
You can’t perform that action at this time.
0 commit comments