forked from OSchip/llvm-project
Refactor attribute printing to be a bit more obviously-correct.
No functionality change intended. llvm-svn: 339306
This commit is contained in:
parent
a60d168d22
commit
89d9cc7da9
|
@ -1398,25 +1398,21 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
|
|||
T->getAttrKind() == AttributedType::attr_objc_ownership)
|
||||
return printAfter(T->getEquivalentType(), OS);
|
||||
|
||||
if (T->getAttrKind() == AttributedType::attr_objc_kindof)
|
||||
return;
|
||||
|
||||
// TODO: not all attributes are GCC-style attributes.
|
||||
if (T->isMSTypeSpec())
|
||||
return;
|
||||
|
||||
// Nothing to print after.
|
||||
if (T->getAttrKind() == AttributedType::attr_nonnull ||
|
||||
T->getAttrKind() == AttributedType::attr_nullable ||
|
||||
T->getAttrKind() == AttributedType::attr_null_unspecified)
|
||||
return printAfter(T->getModifiedType(), OS);
|
||||
|
||||
// If this is a calling convention attribute, don't print the implicit CC from
|
||||
// the modified type.
|
||||
SaveAndRestore<bool> MaybeSuppressCC(InsideCCAttribute, T->isCallingConv());
|
||||
|
||||
printAfter(T->getModifiedType(), OS);
|
||||
|
||||
// Some attributes are printed as qualifiers before the type, so we have
|
||||
// nothing left to do.
|
||||
if (T->getAttrKind() == AttributedType::attr_objc_kindof ||
|
||||
T->isMSTypeSpec() ||
|
||||
T->getAttrKind() == AttributedType::attr_nonnull ||
|
||||
T->getAttrKind() == AttributedType::attr_nullable ||
|
||||
T->getAttrKind() == AttributedType::attr_null_unspecified)
|
||||
return;
|
||||
|
||||
// Don't print the inert __unsafe_unretained attribute at all.
|
||||
if (T->getAttrKind() == AttributedType::attr_objc_inert_unsafe_unretained)
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -ast-print -x objective-c++ -fms-extensions %s -o - | FileCheck %s
|
||||
|
||||
// CHECK: using A = __kindof id (*)[1];
|
||||
using A = __kindof id (*)[1];
|
||||
|
||||
// CHECK: using B = int ** __ptr32 *[3];
|
||||
using B = int ** __ptr32 *[3];
|
||||
|
||||
// FIXME: This is the wrong spelling for the attribute.
|
||||
// FIXME: Too many parens here!
|
||||
// CHECK: using C = int ((*))() __attribute__((cdecl));
|
||||
using C = int (*)() [[gnu::cdecl]];
|
Loading…
Reference in New Issue