[cfe-commits] r158749 - in /cfe/trunk: include/clang/Basic/ include/clang/Parse/ include/clang/Sema/ lib/AST/ lib/Lex/ lib/Parse/ lib/Sema/ test/CodeGen/ test/Parser/ test/Sema/ utils/TableGen/
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Jun 19 14:48:43 PDT 2012
Author: stoklund
Date: Tue Jun 19 16:48:43 2012
New Revision: 158749
URL: http://llvm.org/viewvc/llvm-project?rev=158749&view=rev
Log:
Revert r158700 and dependent patches r158716, r158717, and r158731.
The original r158700 caused crashes in the gcc test suite,
g++.abi/vtable3a.C among others. It also caused failures in the libc++
test suite.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaStmtAttr.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Sema/TargetAttributesSema.cpp
cfe/trunk/test/CodeGen/ms-declspecs.c
cfe/trunk/test/Parser/MicrosoftExtensions.c
cfe/trunk/test/Sema/MicrosoftCompatibility.c
cfe/trunk/test/Sema/MicrosoftExtensions.c
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Jun 19 16:48:43 2012
@@ -80,25 +80,17 @@
list<string> Enums = enums;
}
-// This handles one spelling of an attribute.
-class Spelling<string name, string variety> {
- string Name = name;
- string Variety = variety;
-}
-
-class GNU<string name> : Spelling<name, "GNU">;
-class Declspec<string name> : Spelling<name, "Declspec">;
-class CXX11<string namespace, string name> : Spelling<name, "CXX11"> {
- string Namespace = namespace;
-}
-
class Attr {
// The various ways in which an attribute can be spelled in source
- list<Spelling> Spellings;
+ list<string> Spellings;
// The things to which an attribute can appertain
list<AttrSubject> Subjects;
// The arguments allowed on an attribute
list<Argument> Args = [];
+ // The namespaces in which the attribute appears in C++0x attributes.
+ // The attribute will not be permitted in C++0x attribute-specifiers if
+ // this is empty; the empty string can be used as a namespace.
+ list<string> Namespaces = [];
// Set to true for attributes with arguments which require delayed parsing.
bit LateParsed = 0;
// Set to false to prevent an attribute from being propagated from a template
@@ -130,20 +122,21 @@
//
def AddressSpace : Attr {
- let Spellings = [GNU<"address_space">];
+ let Spellings = ["address_space"];
let Args = [IntArgument<"AddressSpace">];
let ASTNode = 0;
}
def Alias : InheritableAttr {
- let Spellings = [GNU<"alias">];
+ let Spellings = ["alias"];
let Args = [StringArgument<"Aliasee">];
}
def Aligned : InheritableAttr {
- let Spellings = [GNU<"aligned">, GNU<"align">];
+ let Spellings = ["aligned", "align"];
let Subjects = [NonBitField, NormalVar, Tag];
- let Args = [AlignedArgument<"Alignment">, BoolArgument<"IsMSDeclSpec">];
+ let Args = [AlignedArgument<"Alignment">];
+ let Namespaces = ["", "std"];
}
def AlignMac68k : InheritableAttr {
@@ -152,20 +145,20 @@
}
def AllocSize : Attr {
- let Spellings = [GNU<"alloc_size">];
+ let Spellings = ["alloc_size"];
let Args = [VariadicUnsignedArgument<"Args">];
}
def AlwaysInline : InheritableAttr {
- let Spellings = [GNU<"always_inline">];
+ let Spellings = ["always_inline"];
}
def AnalyzerNoReturn : InheritableAttr {
- let Spellings = [GNU<"analyzer_noreturn">];
+ let Spellings = ["analyzer_noreturn"];
}
def Annotate : InheritableParamAttr {
- let Spellings = [GNU<"annotate">];
+ let Spellings = ["annotate"];
let Args = [StringArgument<"Annotation">];
}
@@ -176,7 +169,7 @@
}
def Availability : InheritableAttr {
- let Spellings = [GNU<"availability">];
+ let Spellings = ["availability"];
let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">,
VersionArgument<"deprecated">, VersionArgument<"obsoleted">,
BoolArgument<"unavailable">, StringArgument<"message">];
@@ -189,26 +182,31 @@
} }];
}
+def BaseCheck : Attr {
+ let Spellings = ["base_check"];
+ let ASTNode = 0;
+}
+
def Blocks : InheritableAttr {
- let Spellings = [GNU<"blocks">];
+ let Spellings = ["blocks"];
let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
}
def Bounded : Attr {
- let Spellings = [GNU<"bounded">];
+ let Spellings = ["bounded"];
let ASTNode = 0;
let SemaHandler = 0;
let Ignored = 1;
}
def CarriesDependency : InheritableParamAttr {
- let Spellings = [GNU<"carries_dependency">, CXX11<"","carries_dependency">,
- CXX11<"std","carries_dependency">];
+ let Spellings = ["carries_dependency"];
let Subjects = [ParmVar, Function];
+ let Namespaces = ["", "std"];
}
def CDecl : InheritableAttr {
- let Spellings = [GNU<"cdecl">, GNU<"__cdecl">];
+ let Spellings = ["cdecl", "__cdecl"];
}
// cf_audited_transfer indicates that the given function has been
@@ -216,7 +214,7 @@
// cf_returns_retained attributes. It is generally applied by
// '#pragma clang arc_cf_code_audited' rather than explicitly.
def CFAuditedTransfer : InheritableAttr {
- let Spellings = [GNU<"cf_audited_transfer">];
+ let Spellings = ["cf_audited_transfer"];
let Subjects = [Function];
}
@@ -224,151 +222,152 @@
// It indicates that the function has unknown or unautomatable
// transfer semantics.
def CFUnknownTransfer : InheritableAttr {
- let Spellings = [GNU<"cf_unknown_transfer">];
+ let Spellings = ["cf_unknown_transfer"];
let Subjects = [Function];
}
def CFReturnsAutoreleased : Attr {
- let Spellings = [GNU<"cf_returns_autoreleased">];
+ let Spellings = ["cf_returns_autoreleased"];
let ASTNode = 0;
}
def CFReturnsRetained : InheritableAttr {
- let Spellings = [GNU<"cf_returns_retained">];
+ let Spellings = ["cf_returns_retained"];
let Subjects = [ObjCMethod, Function];
}
def CFReturnsNotRetained : InheritableAttr {
- let Spellings = [GNU<"cf_returns_not_retained">];
+ let Spellings = ["cf_returns_not_retained"];
let Subjects = [ObjCMethod, Function];
}
def CFConsumed : InheritableParamAttr {
- let Spellings = [GNU<"cf_consumed">];
+ let Spellings = ["cf_consumed"];
let Subjects = [ParmVar];
}
def Cleanup : InheritableAttr {
- let Spellings = [GNU<"cleanup">];
+ let Spellings = ["cleanup"];
let Args = [FunctionArgument<"FunctionDecl">];
}
def Cold : InheritableAttr {
- let Spellings = [GNU<"cold">];
+ let Spellings = ["cold"];
}
def Common : InheritableAttr {
- let Spellings = [GNU<"common">];
+ let Spellings = ["common"];
}
def Const : InheritableAttr {
- let Spellings = [GNU<"const">, GNU<"__const">];
+ let Spellings = ["const", "__const"];
}
def Constructor : InheritableAttr {
- let Spellings = [GNU<"constructor">];
+ let Spellings = ["constructor"];
let Args = [IntArgument<"Priority">];
}
def CUDAConstant : InheritableAttr {
- let Spellings = [GNU<"constant">];
+ let Spellings = ["constant"];
}
def CUDADevice : InheritableAttr {
- let Spellings = [GNU<"device">];
+ let Spellings = ["device"];
}
def CUDAGlobal : InheritableAttr {
- let Spellings = [GNU<"global">];
+ let Spellings = ["global"];
}
def CUDAHost : InheritableAttr {
- let Spellings = [GNU<"host">];
+ let Spellings = ["host"];
}
def CUDALaunchBounds : InheritableAttr {
- let Spellings = [GNU<"launch_bounds">];
+ let Spellings = ["launch_bounds"];
let Args = [IntArgument<"MaxThreads">, DefaultIntArgument<"MinBlocks", 0>];
}
def CUDAShared : InheritableAttr {
- let Spellings = [GNU<"shared">];
+ let Spellings = ["shared"];
}
def OpenCLKernel : Attr {
- let Spellings = [GNU<"opencl_kernel_function">];
+ let Spellings = ["opencl_kernel_function"];
}
def OpenCLImageAccess : Attr {
- let Spellings = [GNU<"opencl_image_access">];
+ let Spellings = ["opencl_image_access"];
let Args = [IntArgument<"Access">];
let ASTNode = 0;
}
def Deprecated : InheritableAttr {
- let Spellings = [GNU<"deprecated">];
+ let Spellings = ["deprecated"];
let Args = [StringArgument<"Message">];
}
def Destructor : InheritableAttr {
- let Spellings = [GNU<"destructor">];
+ let Spellings = ["destructor"];
let Args = [IntArgument<"Priority">];
}
def ExtVectorType : Attr {
- let Spellings = [GNU<"ext_vector_type">];
+ let Spellings = ["ext_vector_type"];
let Args = [ExprArgument<"NumElements">];
let ASTNode = 0;
}
def FallThrough : Attr {
- let Spellings = [GNU<"fallthrough">, CXX11<"clang","fallthrough">];
+ let Namespaces = ["clang"];
+ let Spellings = ["fallthrough"];
let Subjects = [NullStmt];
}
def FastCall : InheritableAttr {
- let Spellings = [GNU<"fastcall">, GNU<"__fastcall">];
+ let Spellings = ["fastcall", "__fastcall"];
}
-def Final : InheritableAttr {
+def Final : InheritableAttr {
let Spellings = [];
let SemaHandler = 0;
}
def Format : InheritableAttr {
- let Spellings = [GNU<"format">];
+ let Spellings = ["format"];
let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">,
IntArgument<"FirstArg">];
}
def FormatArg : InheritableAttr {
- let Spellings = [GNU<"format_arg">];
+ let Spellings = ["format_arg"];
let Args = [IntArgument<"FormatIdx">];
}
def GNUInline : InheritableAttr {
- let Spellings = [GNU<"gnu_inline">];
+ let Spellings = ["gnu_inline"];
}
def Hot : InheritableAttr {
- let Spellings = [GNU<"hot">];
+ let Spellings = ["hot"];
}
def IBAction : InheritableAttr {
- let Spellings = [GNU<"ibaction">];
+ let Spellings = ["ibaction"];
}
def IBOutlet : InheritableAttr {
- let Spellings = [GNU<"iboutlet">];
+ let Spellings = ["iboutlet"];
}
def IBOutletCollection : InheritableAttr {
- let Spellings = [GNU<"iboutletcollection">];
+ let Spellings = ["iboutletcollection"];
let Args = [TypeArgument<"Interface">, SourceLocArgument<"InterfaceLoc">];
}
def Malloc : InheritableAttr {
- let Spellings = [GNU<"malloc">];
+ let Spellings = ["malloc"];
}
def MaxFieldAlignment : InheritableAttr {
@@ -378,7 +377,7 @@
}
def MayAlias : InheritableAttr {
- let Spellings = [GNU<"may_alias">];
+ let Spellings = ["may_alias"];
}
def MSP430Interrupt : InheritableAttr {
@@ -398,45 +397,45 @@
}
def Mode : Attr {
- let Spellings = [GNU<"mode">];
+ let Spellings = ["mode"];
let Args = [IdentifierArgument<"Mode">];
let ASTNode = 0;
}
def Naked : InheritableAttr {
- let Spellings = [GNU<"naked">];
+ let Spellings = ["naked"];
}
def NeonPolyVectorType : Attr {
- let Spellings = [GNU<"neon_polyvector_type">];
+ let Spellings = ["neon_polyvector_type"];
let Args = [IntArgument<"NumElements">];
let ASTNode = 0;
}
def NeonVectorType : Attr {
- let Spellings = [GNU<"neon_vector_type">];
+ let Spellings = ["neon_vector_type"];
let Args = [IntArgument<"NumElements">];
let ASTNode = 0;
}
def ReturnsTwice : InheritableAttr {
- let Spellings = [GNU<"returns_twice">];
+ let Spellings = ["returns_twice"];
}
def NoCommon : InheritableAttr {
- let Spellings = [GNU<"nocommon">];
+ let Spellings = ["nocommon"];
}
def NoDebug : InheritableAttr {
- let Spellings = [GNU<"nodebug">];
+ let Spellings = ["nodebug"];
}
def NoInline : InheritableAttr {
- let Spellings = [GNU<"noinline">];
+ let Spellings = ["noinline"];
}
def NonNull : InheritableAttr {
- let Spellings = [GNU<"nonnull">];
+ let Spellings = ["nonnull"];
let Args = [VariadicUnsignedArgument<"Args">];
let AdditionalMembers =
[{bool isNonNull(unsigned idx) const {
@@ -449,58 +448,58 @@
}
def NoReturn : InheritableAttr {
- let Spellings = [GNU<"noreturn">, CXX11<"","noreturn">,
- CXX11<"std","noreturn">];
+ let Spellings = ["noreturn"];
// FIXME: Does GCC allow this on the function instead?
let Subjects = [Function];
+ let Namespaces = ["", "std"];
}
def NoInstrumentFunction : InheritableAttr {
- let Spellings = [GNU<"no_instrument_function">];
+ let Spellings = ["no_instrument_function"];
let Subjects = [Function];
}
def NoThrow : InheritableAttr {
- let Spellings = [GNU<"nothrow">];
+ let Spellings = ["nothrow"];
}
def NSBridged : InheritableAttr {
- let Spellings = [GNU<"ns_bridged">];
+ let Spellings = ["ns_bridged"];
let Subjects = [Record];
let Args = [IdentifierArgument<"BridgedType">];
}
def NSReturnsRetained : InheritableAttr {
- let Spellings = [GNU<"ns_returns_retained">];
+ let Spellings = ["ns_returns_retained"];
let Subjects = [ObjCMethod, Function];
}
def NSReturnsNotRetained : InheritableAttr {
- let Spellings = [GNU<"ns_returns_not_retained">];
+ let Spellings = ["ns_returns_not_retained"];
let Subjects = [ObjCMethod, Function];
}
def NSReturnsAutoreleased : InheritableAttr {
- let Spellings = [GNU<"ns_returns_autoreleased">];
+ let Spellings = ["ns_returns_autoreleased"];
let Subjects = [ObjCMethod, Function];
}
def NSConsumesSelf : InheritableAttr {
- let Spellings = [GNU<"ns_consumes_self">];
+ let Spellings = ["ns_consumes_self"];
let Subjects = [ObjCMethod];
}
def NSConsumed : InheritableParamAttr {
- let Spellings = [GNU<"ns_consumed">];
+ let Spellings = ["ns_consumed"];
let Subjects = [ParmVar];
}
def ObjCException : InheritableAttr {
- let Spellings = [GNU<"objc_exception">];
+ let Spellings = ["objc_exception"];
}
def ObjCMethodFamily : InheritableAttr {
- let Spellings = [GNU<"objc_method_family">];
+ let Spellings = ["objc_method_family"];
let Subjects = [ObjCMethod];
let Args = [EnumArgument<"Family", "FamilyKind",
["none", "alloc", "copy", "init", "mutableCopy", "new"],
@@ -509,26 +508,26 @@
}
def ObjCNSObject : InheritableAttr {
- let Spellings = [GNU<"NSObject">];
+ let Spellings = ["NSObject"];
}
def ObjCPreciseLifetime : Attr {
- let Spellings = [GNU<"objc_precise_lifetime">];
+ let Spellings = ["objc_precise_lifetime"];
let Subjects = [Var];
}
def ObjCReturnsInnerPointer : Attr {
- let Spellings = [GNU<"objc_returns_inner_pointer">];
+ let Spellings = ["objc_returns_inner_pointer"];
let Subjects = [ObjCMethod];
}
def ObjCRootClass : Attr {
- let Spellings = [GNU<"objc_root_class">];
+ let Spellings = ["objc_root_class"];
let Subjects = [ObjCInterface];
}
def Overloadable : Attr {
- let Spellings = [GNU<"overloadable">];
+ let Spellings = ["overloadable"];
}
def Override : InheritableAttr {
@@ -537,8 +536,7 @@
}
def Ownership : InheritableAttr {
- let Spellings = [GNU<"ownership_holds">, GNU<"ownership_returns">,
- GNU<"ownership_takes">];
+ let Spellings = ["ownership_holds", "ownership_returns", "ownership_takes"];
let DistinctSpellings = 1;
let Args = [EnumArgument<"OwnKind", "OwnershipKind",
["ownership_holds", "ownership_returns", "ownership_takes"],
@@ -547,112 +545,112 @@
}
def Packed : InheritableAttr {
- let Spellings = [GNU<"packed">];
+ let Spellings = ["packed"];
}
def Pcs : InheritableAttr {
- let Spellings = [GNU<"pcs">];
+ let Spellings = ["pcs"];
let Args = [EnumArgument<"PCS", "PCSType",
["aapcs", "aapcs-vfp"],
["AAPCS", "AAPCS_VFP"]>];
}
def Pure : InheritableAttr {
- let Spellings = [GNU<"pure">];
+ let Spellings = ["pure"];
}
def Regparm : InheritableAttr {
- let Spellings = [GNU<"regparm">];
+ let Spellings = ["regparm"];
let Args = [UnsignedArgument<"NumParams">];
}
def ReqdWorkGroupSize : InheritableAttr {
- let Spellings = [GNU<"reqd_work_group_size">];
+ let Spellings = ["reqd_work_group_size"];
let Args = [UnsignedArgument<"XDim">, UnsignedArgument<"YDim">,
UnsignedArgument<"ZDim">];
}
def InitPriority : InheritableAttr {
- let Spellings = [GNU<"init_priority">];
+ let Spellings = ["init_priority"];
let Args = [UnsignedArgument<"Priority">];
}
def Section : InheritableAttr {
- let Spellings = [GNU<"section">];
+ let Spellings = ["section"];
let Args = [StringArgument<"Name">];
}
def Sentinel : InheritableAttr {
- let Spellings = [GNU<"sentinel">];
+ let Spellings = ["sentinel"];
let Args = [DefaultIntArgument<"Sentinel", 0>,
DefaultIntArgument<"NullPos", 0>];
}
def StdCall : InheritableAttr {
- let Spellings = [GNU<"stdcall">, GNU<"__stdcall">];
+ let Spellings = ["stdcall", "__stdcall"];
}
def ThisCall : InheritableAttr {
- let Spellings = [GNU<"thiscall">, GNU<"__thiscall">];
+ let Spellings = ["thiscall", "__thiscall"];
}
def Pascal : InheritableAttr {
- let Spellings = [GNU<"pascal">];
+ let Spellings = ["pascal", "__pascal"];
}
def TransparentUnion : InheritableAttr {
- let Spellings = [GNU<"transparent_union">];
+ let Spellings = ["transparent_union"];
}
def Unavailable : InheritableAttr {
- let Spellings = [GNU<"unavailable">];
+ let Spellings = ["unavailable"];
let Args = [StringArgument<"Message">];
}
def ArcWeakrefUnavailable : InheritableAttr {
- let Spellings = [GNU<"objc_arc_weak_reference_unavailable">];
+ let Spellings = ["objc_arc_weak_reference_unavailable"];
let Subjects = [ObjCInterface];
}
def ObjCGC : Attr {
- let Spellings = [GNU<"objc_gc">];
+ let Spellings = ["objc_gc"];
let Args = [IdentifierArgument<"Kind">];
let ASTNode = 0;
}
def ObjCOwnership : Attr {
- let Spellings = [GNU<"objc_ownership">];
+ let Spellings = ["objc_ownership"];
let Args = [IdentifierArgument<"Kind">];
let ASTNode = 0;
}
def ObjCRequiresPropertyDefs : InheritableAttr {
- let Spellings = [GNU<"objc_requires_property_definitions">];
+ let Spellings = ["objc_requires_property_definitions"];
let Subjects = [ObjCInterface];
}
def Unused : InheritableAttr {
- let Spellings = [GNU<"unused">];
+ let Spellings = ["unused"];
}
def Used : InheritableAttr {
- let Spellings = [GNU<"used">];
+ let Spellings = ["used"];
}
def Uuid : InheritableAttr {
- let Spellings = [GNU<"uuid">];
+ let Spellings = ["uuid"];
let Args = [StringArgument<"Guid">];
let Subjects = [CXXRecord];
}
def VectorSize : Attr {
- let Spellings = [GNU<"vector_size">];
+ let Spellings = ["vector_size"];
let Args = [ExprArgument<"NumBytes">];
let ASTNode = 0;
}
def VecTypeHint : Attr {
- let Spellings = [GNU<"vec_type_hint">];
+ let Spellings = ["vec_type_hint"];
let ASTNode = 0;
let SemaHandler = 0;
let Ignored = 1;
@@ -660,31 +658,31 @@
def Visibility : InheritableAttr {
let Clone = 0;
- let Spellings = [GNU<"visibility">];
+ let Spellings = ["visibility"];
let Args = [EnumArgument<"Visibility", "VisibilityType",
["default", "hidden", "internal", "protected"],
["Default", "Hidden", "Hidden", "Protected"]>];
}
def VecReturn : InheritableAttr {
- let Spellings = [GNU<"vecreturn">];
+ let Spellings = ["vecreturn"];
let Subjects = [CXXRecord];
}
def WarnUnusedResult : InheritableAttr {
- let Spellings = [GNU<"warn_unused_result">];
+ let Spellings = ["warn_unused_result"];
}
def Weak : InheritableAttr {
- let Spellings = [GNU<"weak">];
+ let Spellings = ["weak"];
}
def WeakImport : InheritableAttr {
- let Spellings = [GNU<"weak_import">];
+ let Spellings = ["weak_import"];
}
def WeakRef : InheritableAttr {
- let Spellings = [GNU<"weakref">];
+ let Spellings = ["weakref"];
}
def X86ForceAlignArgPointer : InheritableAttr {
@@ -693,68 +691,68 @@
// AddressSafety attribute (e.g. for AddressSanitizer)
def NoAddressSafetyAnalysis : InheritableAttr {
- let Spellings = [GNU<"no_address_safety_analysis">];
+ let Spellings = ["no_address_safety_analysis"];
}
// C/C++ Thread safety attributes (e.g. for deadlock, data race checking)
def GuardedVar : InheritableAttr {
- let Spellings = [GNU<"guarded_var">];
+ let Spellings = ["guarded_var"];
}
def PtGuardedVar : InheritableAttr {
- let Spellings = [GNU<"pt_guarded_var">];
+ let Spellings = ["pt_guarded_var"];
}
def Lockable : InheritableAttr {
- let Spellings = [GNU<"lockable">];
+ let Spellings = ["lockable"];
}
def ScopedLockable : InheritableAttr {
- let Spellings = [GNU<"scoped_lockable">];
+ let Spellings = ["scoped_lockable"];
}
def NoThreadSafetyAnalysis : InheritableAttr {
- let Spellings = [GNU<"no_thread_safety_analysis">];
+ let Spellings = ["no_thread_safety_analysis"];
}
def GuardedBy : InheritableAttr {
- let Spellings = [GNU<"guarded_by">];
+ let Spellings = ["guarded_by"];
let Args = [ExprArgument<"Arg">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def PtGuardedBy : InheritableAttr {
- let Spellings = [GNU<"pt_guarded_by">];
+ let Spellings = ["pt_guarded_by"];
let Args = [ExprArgument<"Arg">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def AcquiredAfter : InheritableAttr {
- let Spellings = [GNU<"acquired_after">];
+ let Spellings = ["acquired_after"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def AcquiredBefore : InheritableAttr {
- let Spellings = [GNU<"acquired_before">];
+ let Spellings = ["acquired_before"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def ExclusiveLockFunction : InheritableAttr {
- let Spellings = [GNU<"exclusive_lock_function">];
+ let Spellings = ["exclusive_lock_function"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def SharedLockFunction : InheritableAttr {
- let Spellings = [GNU<"shared_lock_function">];
+ let Spellings = ["shared_lock_function"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
@@ -763,7 +761,7 @@
// The first argument is an integer or boolean value specifying the return value
// of a successful lock acquisition.
def ExclusiveTrylockFunction : InheritableAttr {
- let Spellings = [GNU<"exclusive_trylock_function">];
+ let Spellings = ["exclusive_trylock_function"];
let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
@@ -772,42 +770,42 @@
// The first argument is an integer or boolean value specifying the return value
// of a successful lock acquisition.
def SharedTrylockFunction : InheritableAttr {
- let Spellings = [GNU<"shared_trylock_function">];
+ let Spellings = ["shared_trylock_function"];
let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def UnlockFunction : InheritableAttr {
- let Spellings = [GNU<"unlock_function">];
+ let Spellings = ["unlock_function"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def LockReturned : InheritableAttr {
- let Spellings = [GNU<"lock_returned">];
+ let Spellings = ["lock_returned"];
let Args = [ExprArgument<"Arg">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def LocksExcluded : InheritableAttr {
- let Spellings = [GNU<"locks_excluded">];
+ let Spellings = ["locks_excluded"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def ExclusiveLocksRequired : InheritableAttr {
- let Spellings = [GNU<"exclusive_locks_required">];
+ let Spellings = ["exclusive_locks_required"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
}
def SharedLocksRequired : InheritableAttr {
- let Spellings = [GNU<"shared_locks_required">];
+ let Spellings = ["shared_locks_required"];
let Args = [VariadicExprArgument<"Args">];
let LateParsed = 1;
let TemplateDependent = 1;
@@ -816,41 +814,41 @@
// Microsoft-related attributes
def MsStruct : InheritableAttr {
- let Spellings = [Declspec<"ms_struct">];
+ let Spellings = ["__ms_struct__"];
}
def DLLExport : InheritableAttr {
- let Spellings = [Declspec<"dllexport">];
+ let Spellings = ["dllexport"];
}
def DLLImport : InheritableAttr {
- let Spellings = [Declspec<"dllimport">];
+ let Spellings = ["dllimport"];
}
def ForceInline : InheritableAttr {
- let Spellings = [Declspec<"__forceinline">];
+ let Spellings = ["__forceinline"];
}
def Win64 : InheritableAttr {
- let Spellings = [Declspec<"w64">];
+ let Spellings = ["__w64"];
}
def Ptr32 : InheritableAttr {
- let Spellings = [Declspec<"__ptr32">];
+ let Spellings = ["__ptr32"];
}
def Ptr64 : InheritableAttr {
- let Spellings = [Declspec<"__ptr64">];
+ let Spellings = ["__ptr64"];
}
def SingleInheritance : InheritableAttr {
- let Spellings = [Declspec<"__single_inheritance">];
+ let Spellings = ["__single_inheritance"];
}
def MultipleInheritance : InheritableAttr {
- let Spellings = [Declspec<"__multiple_inheritance">];
+ let Spellings = ["__multiple_inheritance"];
}
def VirtualInheritance : InheritableAttr {
- let Spellings = [Declspec<"__virtual_inheritance">];
+ let Spellings = ["__virtual_inheritance"];
}
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Jun 19 16:48:43 2012
@@ -481,10 +481,6 @@
"introducing an attribute">;
def err_alignas_pack_exp_unsupported : Error<
"pack expansions in alignment specifiers are not supported yet">;
-def err_ms_declspec_type : Error<
- "__declspec attributes must be an identifier or string literal">;
-def warn_ms_declspec_unknown : Warning<
- "unknown __declspec attribute %0 ignored">, InGroup<UnknownAttributes>;
/// C++ Templates
def err_expected_template : Error<"expected template">;
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 19 16:48:43 2012
@@ -1617,16 +1617,11 @@
def err_attribute_aligned_not_power_of_two : Error<
"requested alignment is not a power of 2">;
-def err_attribute_aligned_greater_than_8192 : Error<
- "requested alignment must be 8192 bytes or smaller">;
def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
"'%0' redeclared without %1 attribute: previous %1 ignored">;
def warn_attribute_ignored : Warning<"%0 attribute ignored">;
def warn_unknown_attribute_ignored : Warning<
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
-def warn_unhandled_ms_attribute_ignored : Warning<
- "__declspec attribute %0 is not supported">,
- InGroup<IgnoredAttributes>;
def warn_attribute_invalid_on_stmt : Warning<
"attribute %0 cannot be specified on a statement">,
InGroup<IgnoredAttributes>;
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Tue Jun 19 16:48:43 2012
@@ -1790,14 +1790,7 @@
}
void ParseMicrosoftAttributes(ParsedAttributes &attrs,
SourceLocation *endLoc = 0);
- void ParseMicrosoftDeclSpec(ParsedAttributes &Attrs);
- bool IsSimpleMicrosoftDeclSpec(IdentifierInfo *Ident);
- void ParseComplexMicrosoftDeclSpec(IdentifierInfo *Ident,
- SourceLocation Loc,
- ParsedAttributes &Attrs);
- void ParseMicrosoftDeclSpecWithSingleArg(IdentifierInfo *AttrName,
- SourceLocation AttrNameLoc,
- ParsedAttributes &Attrs);
+ void ParseMicrosoftDeclSpec(ParsedAttributes &attrs);
void ParseMicrosoftTypeAttributes(ParsedAttributes &attrs);
void ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs);
void ParseBorlandTypeAttributes(ParsedAttributes &attrs);
Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Tue Jun 19 16:48:43 2012
@@ -57,10 +57,7 @@
enum Syntax {
AS_GNU,
AS_CXX11,
- AS_Declspec,
- // eg) __w64, __ptr32, etc. It is implied that an MSTypespec is also
- // a declspec.
- AS_MSTypespec
+ AS_Declspec
};
private:
IdentifierInfo *AttrName;
@@ -184,12 +181,8 @@
IdentifierInfo *getParameterName() const { return ParmName; }
SourceLocation getParameterLoc() const { return ParmLoc; }
- /// Returns true if the attribute is a pure __declspec or a synthesized
- /// declspec representing a type specification (like __w64 or __ptr32).
- bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec ||
- SyntaxUsed == AS_MSTypespec; }
+ bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec; }
bool isCXX0XAttribute() const { return SyntaxUsed == AS_CXX11; }
- bool isMSTypespecAttribute() const { return SyntaxUsed == AS_MSTypespec; }
bool isInvalid() const { return Invalid; }
void setInvalid(bool b = true) const { Invalid = b; }
@@ -256,27 +249,27 @@
}
const AvailabilityChange &getAvailabilityIntroduced() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getKind() == AT_availability && "Not an availability attribute");
return getAvailabilitySlot(IntroducedSlot);
}
const AvailabilityChange &getAvailabilityDeprecated() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getKind() == AT_availability && "Not an availability attribute");
return getAvailabilitySlot(DeprecatedSlot);
}
const AvailabilityChange &getAvailabilityObsoleted() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getKind() == AT_availability && "Not an availability attribute");
return getAvailabilitySlot(ObsoletedSlot);
}
SourceLocation getUnavailableLoc() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getKind() == AT_availability && "Not an availability attribute");
return UnavailableLoc;
}
const Expr * getMessageExpr() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getKind() == AT_availability && "Not an availability attribute");
return MessageExpr;
}
};
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Jun 19 16:48:43 2012
@@ -6338,10 +6338,8 @@
void AddCFAuditedAttribute(Decl *D);
/// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
- void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
- bool isDeclSpec);
- void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T,
- bool isDeclSpec);
+ void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E);
+ void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T);
/// \brief The kind of conversion being performed.
enum CheckedConversionKind {
Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Tue Jun 19 16:48:43 2012
@@ -556,6 +556,9 @@
const CXXRecordDecl *SrcRD =
cast<CXXRecordDecl>(SrcType->castAs<RecordType>()->getDecl());
+ if (!SrcRD->hasAttr<FinalAttr>())
+ return false;
+
const CXXRecordDecl *DestRD =
cast<CXXRecordDecl>(DestType->castAs<RecordType>()->getDecl());
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Tue Jun 19 16:48:43 2012
@@ -791,7 +791,6 @@
if (Name.startswith("__") && Name.endswith("__") && Name.size() >= 4)
Name = Name.substr(2, Name.size() - 4);
- // FIXME: Do we need to handle namespaces here?
return llvm::StringSwitch<bool>(Name)
#include "clang/Lex/AttrSpellings.inc"
.Default(false);
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Jun 19 16:48:43 2012
@@ -277,173 +277,67 @@
Attrs.addNew(AttrName, SourceRange(AttrNameLoc, RParen), 0, AttrNameLoc,
ParmName, ParmLoc, ArgExprs.take(), ArgExprs.size(),
AttributeList::AS_GNU);
- if (BuiltinType && attr->getKind() == AttributeList::AT_IBOutletCollection)
+ if (BuiltinType && attr->getKind() == AttributeList::AT_iboutletcollection)
Diag(Tok, diag::err_iboutletcollection_builtintype);
}
}
-/// \brief Parses a single argument for a declspec, including the
-/// surrounding parens.
-void Parser::ParseMicrosoftDeclSpecWithSingleArg(IdentifierInfo *AttrName,
- SourceLocation AttrNameLoc,
- ParsedAttributes &Attrs)
-{
- BalancedDelimiterTracker T(*this, tok::l_paren);
- if (T.expectAndConsume(diag::err_expected_lparen_after,
- AttrName->getNameStart(), tok::r_paren))
- return;
-
- ExprResult ArgExpr(ParseConstantExpression());
- if (ArgExpr.isInvalid()) {
- T.skipToEnd();
- return;
- }
- Expr *ExprList = ArgExpr.take();
- Attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, SourceLocation(),
- &ExprList, 1, AttributeList::AS_Declspec);
-
- T.consumeClose();
-}
-
-/// \brief Determines whether a declspec is a "simple" one requiring no
-/// arguments.
-bool Parser::IsSimpleMicrosoftDeclSpec(IdentifierInfo *Ident) {
- return llvm::StringSwitch<bool>(Ident->getName())
- .Case("dllimport", true)
- .Case("dllexport", true)
- .Case("noreturn", true)
- .Case("nothrow", true)
- .Case("noinline", true)
- .Case("naked", true)
- .Case("appdomain", true)
- .Case("process", true)
- .Case("jitintrinsic", true)
- .Case("noalias", true)
- .Case("restrict", true)
- .Case("novtable", true)
- .Case("selectany", true)
- .Case("thread", true)
- .Default(false);
-}
-
-/// \brief Attempts to parse a declspec which is not simple (one that takes
-/// parameters). Will return false if we properly handled the declspec, or
-/// true if it is an unknown declspec.
-void Parser::ParseComplexMicrosoftDeclSpec(IdentifierInfo *Ident,
- SourceLocation Loc,
- ParsedAttributes &Attrs) {
- // Try to handle the easy case first -- these declspecs all take a single
- // parameter as their argument.
- if (llvm::StringSwitch<bool>(Ident->getName())
- .Case("uuid", true)
- .Case("align", true)
- .Case("allocate", true)
- .Default(false)) {
- ParseMicrosoftDeclSpecWithSingleArg(Ident, Loc, Attrs);
- } else if (Ident->getName() == "deprecated") {
- // The deprecated declspec has an optional single argument, so we will
- // check for a l-paren to decide whether we should parse an argument or
- // not.
- if (Tok.getKind() == tok::l_paren)
- ParseMicrosoftDeclSpecWithSingleArg(Ident, Loc, Attrs);
- else
- Attrs.addNew(Ident, Loc, 0, Loc, 0, SourceLocation(), 0, 0,
- AttributeList::AS_Declspec);
- } else if (Ident->getName() == "property") {
- // The property declspec is more complex in that it can take one or two
- // assignment expressions as a parameter, but the lhs of the assignment
- // must be named get or put.
- //
- // For right now, we will just skip to the closing right paren of the
- // property expression.
- //
- // FIXME: we should deal with __declspec(property) at some point because it
- // is used in the platform SDK headers for the Parallel Patterns Library
- // and ATL.
- BalancedDelimiterTracker T(*this, tok::l_paren);
- if (T.expectAndConsume(diag::err_expected_lparen_after,
- Ident->getNameStart(), tok::r_paren))
- return;
- T.skipToEnd();
- } else {
- // We don't recognize this as a valid declspec, but instead of creating the
- // attribute and allowing sema to warn about it, we will warn here instead.
- // This is because some attributes have multiple spellings, but we need to
- // disallow that for declspecs (such as align vs aligned). If we made the
- // attribute, we'd have to split the valid declspec spelling logic into
- // both locations.
- Diag(Loc, diag::warn_ms_declspec_unknown) << Ident;
-
- // If there's an open paren, we should eat the open and close parens under
- // the assumption that this unknown declspec has parameters.
- BalancedDelimiterTracker T(*this, tok::l_paren);
- if (!T.consumeOpen())
- T.skipToEnd();
- }
-}
+/// ParseMicrosoftDeclSpec - Parse an __declspec construct
+///
/// [MS] decl-specifier:
/// __declspec ( extended-decl-modifier-seq )
///
/// [MS] extended-decl-modifier-seq:
/// extended-decl-modifier[opt]
/// extended-decl-modifier extended-decl-modifier-seq
-void Parser::ParseMicrosoftDeclSpec(ParsedAttributes &Attrs) {
+
+void Parser::ParseMicrosoftDeclSpec(ParsedAttributes &attrs) {
assert(Tok.is(tok::kw___declspec) && "Not a declspec!");
ConsumeToken();
- BalancedDelimiterTracker T(*this, tok::l_paren);
- if (T.expectAndConsume(diag::err_expected_lparen_after, "__declspec",
- tok::r_paren))
+ if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
+ "declspec")) {
+ SkipUntil(tok::r_paren, true); // skip until ) or ;
return;
+ }
- // An empty declspec is perfectly legal and should not warn. Additionally,
- // you can specify multiple attributes per declspec.
- while (Tok.getKind() != tok::r_paren) {
- // We expect either a well-known identifier or a generic string. Anything
- // else is a malformed declspec.
- bool IsString = Tok.getKind() == tok::string_literal ? true : false;
- if (!IsString && Tok.getKind() != tok::identifier &&
- Tok.getKind() != tok::kw_restrict) {
- Diag(Tok, diag::err_ms_declspec_type);
- T.skipToEnd();
- return;
+ while (Tok.getIdentifierInfo()) {
+ IdentifierInfo *AttrName = Tok.getIdentifierInfo();
+ SourceLocation AttrNameLoc = ConsumeToken();
+
+ // FIXME: Remove this when we have proper __declspec(property()) support.
+ // Just skip everything inside property().
+ if (AttrName->getName() == "property") {
+ ConsumeParen();
+ SkipUntil(tok::r_paren);
}
-
- IdentifierInfo *AttrName;
- SourceLocation AttrNameLoc;
- if (IsString) {
- SmallString<8> StrBuffer;
- bool Invalid = false;
- StringRef Str = PP.getSpelling(Tok, StrBuffer, &Invalid);
- if (Invalid) {
- T.skipToEnd();
- return;
+ if (Tok.is(tok::l_paren)) {
+ ConsumeParen();
+ // FIXME: This doesn't parse __declspec(property(get=get_func_name))
+ // correctly.
+ ExprResult ArgExpr(ParseAssignmentExpression());
+ if (!ArgExpr.isInvalid()) {
+ Expr *ExprList = ArgExpr.take();
+ attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
+ SourceLocation(), &ExprList, 1,
+ AttributeList::AS_Declspec);
}
- AttrName = PP.getIdentifierInfo(Str);
- AttrNameLoc = ConsumeStringToken();
+ if (ExpectAndConsume(tok::r_paren, diag::err_expected_rparen))
+ SkipUntil(tok::r_paren, false);
} else {
- AttrName = Tok.getIdentifierInfo();
- AttrNameLoc = ConsumeToken();
+ attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc,
+ 0, SourceLocation(), 0, 0, AttributeList::AS_Declspec);
}
-
- if (IsString || IsSimpleMicrosoftDeclSpec(AttrName))
- // If we have a generic string, we will allow it because there is no
- // documented list of allowable string declspecs, but we know they exist
- // (for instance, SAL declspecs in older versions of MSVC).
- //
- // Alternatively, if the identifier is a simple one, then it requires no
- // arguments and can be turned into an attribute directly.
- Attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, SourceLocation(),
- 0, 0, AttributeList::AS_Declspec);
- else
- ParseComplexMicrosoftDeclSpec(AttrName, AttrNameLoc, Attrs);
}
- T.consumeClose();
+ if (ExpectAndConsume(tok::r_paren, diag::err_expected_rparen))
+ SkipUntil(tok::r_paren, false);
+ return;
}
void Parser::ParseMicrosoftTypeAttributes(ParsedAttributes &attrs) {
// Treat these like attributes
+ // FIXME: Allow Sema to distinguish between these and real attributes!
while (Tok.is(tok::kw___fastcall) || Tok.is(tok::kw___stdcall) ||
Tok.is(tok::kw___thiscall) || Tok.is(tok::kw___cdecl) ||
Tok.is(tok::kw___ptr64) || Tok.is(tok::kw___w64) ||
@@ -452,7 +346,7 @@
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
- SourceLocation(), 0, 0, AttributeList::AS_MSTypespec);
+ SourceLocation(), 0, 0, AttributeList::AS_Declspec);
}
}
@@ -462,7 +356,7 @@
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
- SourceLocation(), 0, 0, AttributeList::AS_MSTypespec);
+ SourceLocation(), 0, 0, AttributeList::AS_Declspec);
}
}
@@ -1981,12 +1875,9 @@
ExprVector ArgExprs(Actions);
ArgExprs.push_back(ArgExpr.release());
- // FIXME: This should not be GNU, but we since the attribute used is
- // based on the spelling, and there is no true spelling for
- // C++11 attributes, this isn't accepted.
Attrs.addNew(PP.getIdentifierInfo("aligned"), KWLoc, 0, KWLoc,
0, T.getOpenLocation(), ArgExprs.take(), 1,
- AttributeList::AS_GNU);
+ AttributeList::AS_CXX11);
}
/// ParseDeclarationSpecifiers
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Jun 19 16:48:43 2012
@@ -2902,11 +2902,11 @@
switch (AttributeList::getKind(AttrName, ScopeName,
AttributeList::AS_CXX11)) {
// No arguments
- case AttributeList::AT_CarriesDependency:
+ case AttributeList::AT_carries_dependency:
// FIXME: implement generic support of attributes with C++11 syntax
// see Parse/ParseDecl.cpp: ParseGNUAttributes
- case AttributeList::AT_FallThrough:
- case AttributeList::AT_NoReturn: {
+ case AttributeList::AT_fallthrough:
+ case AttributeList::AT_noreturn: {
if (Tok.is(tok::l_paren)) {
Diag(Tok.getLocation(), diag::err_cxx11_attribute_forbids_arguments)
<< AttrName->getName();
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Tue Jun 19 16:48:43 2012
@@ -753,7 +753,7 @@
writtenBS.ModeAttr = false;
AttributeList* attrs = getAttributes().getList();
while (attrs) {
- if (attrs->getKind() == AttributeList::AT_Mode) {
+ if (attrs->getKind() == AttributeList::AT_mode) {
writtenBS.ModeAttr = true;
break;
}
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jun 19 16:48:43 2012
@@ -2894,34 +2894,30 @@
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
-
+
//FIXME: The C++0x version of this attribute has more limited applicabilty
// than GNU's, and should error out when it is used to specify a
// weaker alignment, rather than being silently ignored.
if (Attr.getNumArgs() == 0) {
- D->addAttr(::new (S.Context) AlignedAttr(Attr.getRange(), S.Context,
- true, 0, Attr.isDeclspecAttribute()));
+ D->addAttr(::new (S.Context) AlignedAttr(Attr.getRange(), S.Context, true, 0));
return;
}
- S.AddAlignedAttr(Attr.getRange(), D, Attr.getArg(0),
- Attr.isDeclspecAttribute());
+ S.AddAlignedAttr(Attr.getRange(), D, Attr.getArg(0));
}
-void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
- bool isDeclSpec) {
+void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E) {
// FIXME: Handle pack-expansions here.
if (DiagnoseUnexpandedParameterPack(E))
return;
if (E->isTypeDependent() || E->isValueDependent()) {
// Save dependent expressions in the AST to be instantiated.
- D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, true, E,
- isDeclSpec));
+ D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, true, E));
return;
}
-
+
SourceLocation AttrLoc = AttrRange.getBegin();
// FIXME: Cache the number on the Attr object?
llvm::APSInt Alignment(32);
@@ -2936,26 +2932,14 @@
<< E->getSourceRange();
return;
}
- if (isDeclSpec) {
- // We've already verified it's a power of 2, now let's make sure it's
- // 8192 or less.
- if (Alignment.getZExtValue() > 8192) {
- Diag(AttrLoc, diag::err_attribute_aligned_greater_than_8192)
- << E->getSourceRange();
- return;
- }
- }
- D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, true, ICE.take(),
- isDeclSpec));
+ D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, true, ICE.take()));
}
-void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *TS,
- bool isDeclSpec) {
+void Sema::AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *TS) {
// FIXME: Cache the number on the Attr object if non-dependent?
// FIXME: Perform checking of type validity
- D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, false, TS,
- isDeclSpec));
+ D->addAttr(::new (Context) AlignedAttr(AttrRange, Context, false, TS));
return;
}
@@ -3322,22 +3306,22 @@
}
switch (Attr.getKind()) {
- case AttributeList::AT_FastCall:
+ case AttributeList::AT_fastcall:
D->addAttr(::new (S.Context) FastCallAttr(Attr.getRange(), S.Context));
return;
- case AttributeList::AT_StdCall:
+ case AttributeList::AT_stdcall:
D->addAttr(::new (S.Context) StdCallAttr(Attr.getRange(), S.Context));
return;
- case AttributeList::AT_ThisCall:
+ case AttributeList::AT_thiscall:
D->addAttr(::new (S.Context) ThisCallAttr(Attr.getRange(), S.Context));
return;
- case AttributeList::AT_CDecl:
+ case AttributeList::AT_cdecl:
D->addAttr(::new (S.Context) CDeclAttr(Attr.getRange(), S.Context));
return;
- case AttributeList::AT_Pascal:
+ case AttributeList::AT_pascal:
D->addAttr(::new (S.Context) PascalAttr(Attr.getRange(), S.Context));
return;
- case AttributeList::AT_Pcs: {
+ case AttributeList::AT_pcs: {
Expr *Arg = Attr.getArg(0);
StringLiteral *Str = dyn_cast<StringLiteral>(Arg);
if (!Str || !Str->isAscii()) {
@@ -3376,7 +3360,7 @@
return true;
if ((attr.getNumArgs() != 0 &&
- !(attr.getKind() == AttributeList::AT_Pcs && attr.getNumArgs() == 1)) ||
+ !(attr.getKind() == AttributeList::AT_pcs && attr.getNumArgs() == 1)) ||
attr.getParameterName()) {
Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
attr.setInvalid();
@@ -3386,12 +3370,12 @@
// TODO: diagnose uses of these conventions on the wrong target. Or, better
// move to TargetAttributesSema one day.
switch (attr.getKind()) {
- case AttributeList::AT_CDecl: CC = CC_C; break;
- case AttributeList::AT_FastCall: CC = CC_X86FastCall; break;
- case AttributeList::AT_StdCall: CC = CC_X86StdCall; break;
- case AttributeList::AT_ThisCall: CC = CC_X86ThisCall; break;
- case AttributeList::AT_Pascal: CC = CC_X86Pascal; break;
- case AttributeList::AT_Pcs: {
+ case AttributeList::AT_cdecl: CC = CC_C; break;
+ case AttributeList::AT_fastcall: CC = CC_X86FastCall; break;
+ case AttributeList::AT_stdcall: CC = CC_X86StdCall; break;
+ case AttributeList::AT_thiscall: CC = CC_X86ThisCall; break;
+ case AttributeList::AT_pascal: CC = CC_X86Pascal; break;
+ case AttributeList::AT_pcs: {
Expr *Arg = attr.getArg(0);
StringLiteral *Str = dyn_cast<StringLiteral>(Arg);
if (!Str || !Str->isAscii()) {
@@ -3542,7 +3526,7 @@
}
bool typeOK, cf;
- if (Attr.getKind() == AttributeList::AT_NSConsumed) {
+ if (Attr.getKind() == AttributeList::AT_ns_consumed) {
typeOK = isValidSubjectOfNSAttribute(S, param->getType());
cf = false;
} else {
@@ -3583,7 +3567,7 @@
else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D))
returnType = PD->getType();
else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) &&
- (Attr.getKind() == AttributeList::AT_NSReturnsRetained))
+ (Attr.getKind() == AttributeList::AT_ns_returns_retained))
return; // ignore: was handled as a type attribute
else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
returnType = FD->getResultType();
@@ -3598,15 +3582,15 @@
bool cf;
switch (Attr.getKind()) {
default: llvm_unreachable("invalid ownership attribute");
- case AttributeList::AT_NSReturnsAutoreleased:
- case AttributeList::AT_NSReturnsRetained:
- case AttributeList::AT_NSReturnsNotRetained:
+ case AttributeList::AT_ns_returns_autoreleased:
+ case AttributeList::AT_ns_returns_retained:
+ case AttributeList::AT_ns_returns_not_retained:
typeOK = isValidSubjectOfNSAttribute(S, returnType);
cf = false;
break;
- case AttributeList::AT_CFReturnsRetained:
- case AttributeList::AT_CFReturnsNotRetained:
+ case AttributeList::AT_cf_returns_retained:
+ case AttributeList::AT_cf_returns_not_retained:
typeOK = isValidSubjectOfCFAttribute(S, returnType);
cf = true;
break;
@@ -3621,23 +3605,23 @@
switch (Attr.getKind()) {
default:
llvm_unreachable("invalid ownership attribute");
- case AttributeList::AT_NSReturnsAutoreleased:
+ case AttributeList::AT_ns_returns_autoreleased:
D->addAttr(::new (S.Context) NSReturnsAutoreleasedAttr(Attr.getRange(),
S.Context));
return;
- case AttributeList::AT_CFReturnsNotRetained:
+ case AttributeList::AT_cf_returns_not_retained:
D->addAttr(::new (S.Context) CFReturnsNotRetainedAttr(Attr.getRange(),
S.Context));
return;
- case AttributeList::AT_NSReturnsNotRetained:
+ case AttributeList::AT_ns_returns_not_retained:
D->addAttr(::new (S.Context) NSReturnsNotRetainedAttr(Attr.getRange(),
S.Context));
return;
- case AttributeList::AT_CFReturnsRetained:
+ case AttributeList::AT_cf_returns_retained:
D->addAttr(::new (S.Context) CFReturnsRetainedAttr(Attr.getRange(),
S.Context));
return;
- case AttributeList::AT_NSReturnsRetained:
+ case AttributeList::AT_ns_returns_retained:
D->addAttr(::new (S.Context) NSReturnsRetainedAttr(Attr.getRange(),
S.Context));
return;
@@ -3681,7 +3665,7 @@
return;
}
- bool IsAudited = (A.getKind() == AttributeList::AT_CFAuditedTransfer);
+ bool IsAudited = (A.getKind() == AttributeList::AT_cf_audited_transfer);
// Check whether there's a conflicting attribute already present.
Attr *Existing;
@@ -3792,6 +3776,22 @@
ObjCPreciseLifetimeAttr(Attr.getRange(), S.Context));
}
+static bool isKnownDeclSpecAttr(const AttributeList &Attr) {
+ switch (Attr.getKind()) {
+ default:
+ return false;
+ case AttributeList::AT_dllimport:
+ case AttributeList::AT_dllexport:
+ case AttributeList::AT_uuid:
+ case AttributeList::AT_deprecated:
+ case AttributeList::AT_noreturn:
+ case AttributeList::AT_nothrow:
+ case AttributeList::AT_naked:
+ case AttributeList::AT_noinline:
+ return true;
+ }
+}
+
//===----------------------------------------------------------------------===//
// Microsoft specific attribute handlers.
//===----------------------------------------------------------------------===//
@@ -3853,13 +3853,13 @@
static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) {
if (S.LangOpts.MicrosoftExt) {
AttributeList::Kind Kind = Attr.getKind();
- if (Kind == AttributeList::AT_SingleInheritance)
+ if (Kind == AttributeList::AT_single_inheritance)
D->addAttr(
::new (S.Context) SingleInheritanceAttr(Attr.getRange(), S.Context));
- else if (Kind == AttributeList::AT_MultipleInheritance)
+ else if (Kind == AttributeList::AT_multiple_inheritance)
D->addAttr(
::new (S.Context) MultipleInheritanceAttr(Attr.getRange(), S.Context));
- else if (Kind == AttributeList::AT_VirtualInheritance)
+ else if (Kind == AttributeList::AT_virtual_inheritance)
D->addAttr(
::new (S.Context) VirtualInheritanceAttr(Attr.getRange(), S.Context));
} else
@@ -3869,13 +3869,13 @@
static void handlePortabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) {
if (S.LangOpts.MicrosoftExt) {
AttributeList::Kind Kind = Attr.getKind();
- if (Kind == AttributeList::AT_Ptr32)
+ if (Kind == AttributeList::AT_ptr32)
D->addAttr(
::new (S.Context) Ptr32Attr(Attr.getRange(), S.Context));
- else if (Kind == AttributeList::AT_Ptr64)
+ else if (Kind == AttributeList::AT_ptr64)
D->addAttr(
::new (S.Context) Ptr64Attr(Attr.getRange(), S.Context));
- else if (Kind == AttributeList::AT_Win64)
+ else if (Kind == AttributeList::AT_w64)
D->addAttr(
::new (S.Context) Win64Attr(Attr.getRange(), S.Context));
} else
@@ -3896,9 +3896,9 @@
static void ProcessNonInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
const AttributeList &Attr) {
switch (Attr.getKind()) {
- case AttributeList::AT_CUDADevice: handleDeviceAttr (S, D, Attr); break;
- case AttributeList::AT_CUDAHost: handleHostAttr (S, D, Attr); break;
- case AttributeList::AT_Overloadable:handleOverloadableAttr(S, D, Attr); break;
+ case AttributeList::AT_device: handleDeviceAttr (S, D, Attr); break;
+ case AttributeList::AT_host: handleHostAttr (S, D, Attr); break;
+ case AttributeList::AT_overloadable:handleOverloadableAttr(S, D, Attr); break;
default:
break;
}
@@ -3907,242 +3907,242 @@
static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
const AttributeList &Attr) {
switch (Attr.getKind()) {
- case AttributeList::AT_IBAction: handleIBAction(S, D, Attr); break;
- case AttributeList::AT_IBOutlet: handleIBOutlet(S, D, Attr); break;
- case AttributeList::AT_IBOutletCollection:
+ case AttributeList::AT_ibaction: handleIBAction(S, D, Attr); break;
+ case AttributeList::AT_iboutlet: handleIBOutlet(S, D, Attr); break;
+ case AttributeList::AT_iboutletcollection:
handleIBOutletCollection(S, D, Attr); break;
- case AttributeList::AT_AddressSpace:
- case AttributeList::AT_OpenCLImageAccess:
- case AttributeList::AT_ObjCGC:
- case AttributeList::AT_VectorSize:
- case AttributeList::AT_NeonVectorType:
- case AttributeList::AT_NeonPolyVectorType:
+ case AttributeList::AT_address_space:
+ case AttributeList::AT_opencl_image_access:
+ case AttributeList::AT_objc_gc:
+ case AttributeList::AT_vector_size:
+ case AttributeList::AT_neon_vector_type:
+ case AttributeList::AT_neon_polyvector_type:
// Ignore these, these are type attributes, handled by
// ProcessTypeAttributes.
break;
- case AttributeList::AT_CUDADevice:
- case AttributeList::AT_CUDAHost:
- case AttributeList::AT_Overloadable:
+ case AttributeList::AT_device:
+ case AttributeList::AT_host:
+ case AttributeList::AT_overloadable:
// Ignore, this is a non-inheritable attribute, handled
// by ProcessNonInheritableDeclAttr.
break;
- case AttributeList::AT_Alias: handleAliasAttr (S, D, Attr); break;
- case AttributeList::AT_Aligned: handleAlignedAttr (S, D, Attr); break;
- case AttributeList::AT_AllocSize: handleAllocSizeAttr (S, D, Attr); break;
- case AttributeList::AT_AlwaysInline:
+ case AttributeList::AT_alias: handleAliasAttr (S, D, Attr); break;
+ case AttributeList::AT_aligned: handleAlignedAttr (S, D, Attr); break;
+ case AttributeList::AT_alloc_size: handleAllocSizeAttr (S, D, Attr); break;
+ case AttributeList::AT_always_inline:
handleAlwaysInlineAttr (S, D, Attr); break;
- case AttributeList::AT_AnalyzerNoReturn:
+ case AttributeList::AT_analyzer_noreturn:
handleAnalyzerNoReturnAttr (S, D, Attr); break;
- case AttributeList::AT_Annotate: handleAnnotateAttr (S, D, Attr); break;
- case AttributeList::AT_Availability:handleAvailabilityAttr(S, D, Attr); break;
- case AttributeList::AT_CarriesDependency:
+ case AttributeList::AT_annotate: handleAnnotateAttr (S, D, Attr); break;
+ case AttributeList::AT_availability:handleAvailabilityAttr(S, D, Attr); break;
+ case AttributeList::AT_carries_dependency:
handleDependencyAttr (S, D, Attr); break;
- case AttributeList::AT_Common: handleCommonAttr (S, D, Attr); break;
- case AttributeList::AT_CUDAConstant:handleConstantAttr (S, D, Attr); break;
- case AttributeList::AT_Constructor: handleConstructorAttr (S, D, Attr); break;
- case AttributeList::AT_Deprecated:
+ case AttributeList::AT_common: handleCommonAttr (S, D, Attr); break;
+ case AttributeList::AT_constant: handleConstantAttr (S, D, Attr); break;
+ case AttributeList::AT_constructor: handleConstructorAttr (S, D, Attr); break;
+ case AttributeList::AT_deprecated:
handleAttrWithMessage<DeprecatedAttr>(S, D, Attr, "deprecated");
break;
- case AttributeList::AT_Destructor: handleDestructorAttr (S, D, Attr); break;
- case AttributeList::AT_ExtVectorType:
+ case AttributeList::AT_destructor: handleDestructorAttr (S, D, Attr); break;
+ case AttributeList::AT_ext_vector_type:
handleExtVectorTypeAttr(S, scope, D, Attr);
break;
- case AttributeList::AT_Format: handleFormatAttr (S, D, Attr); break;
- case AttributeList::AT_FormatArg: handleFormatArgAttr (S, D, Attr); break;
- case AttributeList::AT_CUDAGlobal: handleGlobalAttr (S, D, Attr); break;
- case AttributeList::AT_GNUInline: handleGNUInlineAttr (S, D, Attr); break;
- case AttributeList::AT_CUDALaunchBounds:
+ case AttributeList::AT_format: handleFormatAttr (S, D, Attr); break;
+ case AttributeList::AT_format_arg: handleFormatArgAttr (S, D, Attr); break;
+ case AttributeList::AT_global: handleGlobalAttr (S, D, Attr); break;
+ case AttributeList::AT_gnu_inline: handleGNUInlineAttr (S, D, Attr); break;
+ case AttributeList::AT_launch_bounds:
handleLaunchBoundsAttr(S, D, Attr);
break;
- case AttributeList::AT_Mode: handleModeAttr (S, D, Attr); break;
- case AttributeList::AT_Malloc: handleMallocAttr (S, D, Attr); break;
- case AttributeList::AT_MayAlias: handleMayAliasAttr (S, D, Attr); break;
- case AttributeList::AT_NoCommon: handleNoCommonAttr (S, D, Attr); break;
- case AttributeList::AT_NonNull: handleNonNullAttr (S, D, Attr); break;
+ case AttributeList::AT_mode: handleModeAttr (S, D, Attr); break;
+ case AttributeList::AT_malloc: handleMallocAttr (S, D, Attr); break;
+ case AttributeList::AT_may_alias: handleMayAliasAttr (S, D, Attr); break;
+ case AttributeList::AT_nocommon: handleNoCommonAttr (S, D, Attr); break;
+ case AttributeList::AT_nonnull: handleNonNullAttr (S, D, Attr); break;
case AttributeList::AT_ownership_returns:
case AttributeList::AT_ownership_takes:
case AttributeList::AT_ownership_holds:
handleOwnershipAttr (S, D, Attr); break;
- case AttributeList::AT_Cold: handleColdAttr (S, D, Attr); break;
- case AttributeList::AT_Hot: handleHotAttr (S, D, Attr); break;
- case AttributeList::AT_Naked: handleNakedAttr (S, D, Attr); break;
- case AttributeList::AT_NoReturn: handleNoReturnAttr (S, D, Attr); break;
- case AttributeList::AT_NoThrow: handleNothrowAttr (S, D, Attr); break;
- case AttributeList::AT_CUDAShared: handleSharedAttr (S, D, Attr); break;
- case AttributeList::AT_VecReturn: handleVecReturnAttr (S, D, Attr); break;
+ case AttributeList::AT_cold: handleColdAttr (S, D, Attr); break;
+ case AttributeList::AT_hot: handleHotAttr (S, D, Attr); break;
+ case AttributeList::AT_naked: handleNakedAttr (S, D, Attr); break;
+ case AttributeList::AT_noreturn: handleNoReturnAttr (S, D, Attr); break;
+ case AttributeList::AT_nothrow: handleNothrowAttr (S, D, Attr); break;
+ case AttributeList::AT_shared: handleSharedAttr (S, D, Attr); break;
+ case AttributeList::AT_vecreturn: handleVecReturnAttr (S, D, Attr); break;
- case AttributeList::AT_ObjCOwnership:
+ case AttributeList::AT_objc_ownership:
handleObjCOwnershipAttr(S, D, Attr); break;
- case AttributeList::AT_ObjCPreciseLifetime:
+ case AttributeList::AT_objc_precise_lifetime:
handleObjCPreciseLifetimeAttr(S, D, Attr); break;
- case AttributeList::AT_ObjCReturnsInnerPointer:
+ case AttributeList::AT_objc_returns_inner_pointer:
handleObjCReturnsInnerPointerAttr(S, D, Attr); break;
- case AttributeList::AT_NSBridged:
+ case AttributeList::AT_ns_bridged:
handleNSBridgedAttr(S, scope, D, Attr); break;
- case AttributeList::AT_CFAuditedTransfer:
- case AttributeList::AT_CFUnknownTransfer:
+ case AttributeList::AT_cf_audited_transfer:
+ case AttributeList::AT_cf_unknown_transfer:
handleCFTransferAttr(S, D, Attr); break;
// Checker-specific.
- case AttributeList::AT_CFConsumed:
- case AttributeList::AT_NSConsumed: handleNSConsumedAttr (S, D, Attr); break;
- case AttributeList::AT_NSConsumesSelf:
+ case AttributeList::AT_cf_consumed:
+ case AttributeList::AT_ns_consumed: handleNSConsumedAttr (S, D, Attr); break;
+ case AttributeList::AT_ns_consumes_self:
handleNSConsumesSelfAttr(S, D, Attr); break;
- case AttributeList::AT_NSReturnsAutoreleased:
- case AttributeList::AT_NSReturnsNotRetained:
- case AttributeList::AT_CFReturnsNotRetained:
- case AttributeList::AT_NSReturnsRetained:
- case AttributeList::AT_CFReturnsRetained:
+ case AttributeList::AT_ns_returns_autoreleased:
+ case AttributeList::AT_ns_returns_not_retained:
+ case AttributeList::AT_cf_returns_not_retained:
+ case AttributeList::AT_ns_returns_retained:
+ case AttributeList::AT_cf_returns_retained:
handleNSReturnsRetainedAttr(S, D, Attr); break;
- case AttributeList::AT_ReqdWorkGroupSize:
+ case AttributeList::AT_reqd_work_group_size:
handleReqdWorkGroupSize(S, D, Attr); break;
- case AttributeList::AT_InitPriority:
+ case AttributeList::AT_init_priority:
handleInitPriorityAttr(S, D, Attr); break;
- case AttributeList::AT_Packed: handlePackedAttr (S, D, Attr); break;
- case AttributeList::AT_Section: handleSectionAttr (S, D, Attr); break;
- case AttributeList::AT_Unavailable:
+ case AttributeList::AT_packed: handlePackedAttr (S, D, Attr); break;
+ case AttributeList::AT_section: handleSectionAttr (S, D, Attr); break;
+ case AttributeList::AT_unavailable:
handleAttrWithMessage<UnavailableAttr>(S, D, Attr, "unavailable");
break;
- case AttributeList::AT_ArcWeakrefUnavailable:
+ case AttributeList::AT_objc_arc_weak_reference_unavailable:
handleArcWeakrefUnavailableAttr (S, D, Attr);
break;
- case AttributeList::AT_ObjCRootClass:
+ case AttributeList::AT_objc_root_class:
handleObjCRootClassAttr(S, D, Attr);
break;
- case AttributeList::AT_ObjCRequiresPropertyDefs:
+ case AttributeList::AT_objc_requires_property_definitions:
handleObjCRequiresPropertyDefsAttr (S, D, Attr);
break;
- case AttributeList::AT_Unused: handleUnusedAttr (S, D, Attr); break;
- case AttributeList::AT_ReturnsTwice:
+ case AttributeList::AT_unused: handleUnusedAttr (S, D, Attr); break;
+ case AttributeList::AT_returns_twice:
handleReturnsTwiceAttr(S, D, Attr);
break;
- case AttributeList::AT_Used: handleUsedAttr (S, D, Attr); break;
- case AttributeList::AT_Visibility: handleVisibilityAttr (S, D, Attr); break;
- case AttributeList::AT_WarnUnusedResult: handleWarnUnusedResult(S, D, Attr);
- break;
- case AttributeList::AT_Weak: handleWeakAttr (S, D, Attr); break;
- case AttributeList::AT_WeakRef: handleWeakRefAttr (S, D, Attr); break;
- case AttributeList::AT_WeakImport: handleWeakImportAttr (S, D, Attr); break;
- case AttributeList::AT_TransparentUnion:
+ case AttributeList::AT_used: handleUsedAttr (S, D, Attr); break;
+ case AttributeList::AT_visibility: handleVisibilityAttr (S, D, Attr); break;
+ case AttributeList::AT_warn_unused_result: handleWarnUnusedResult(S, D, Attr);
+ break;
+ case AttributeList::AT_weak: handleWeakAttr (S, D, Attr); break;
+ case AttributeList::AT_weakref: handleWeakRefAttr (S, D, Attr); break;
+ case AttributeList::AT_weak_import: handleWeakImportAttr (S, D, Attr); break;
+ case AttributeList::AT_transparent_union:
handleTransparentUnionAttr(S, D, Attr);
break;
- case AttributeList::AT_ObjCException:
+ case AttributeList::AT_objc_exception:
handleObjCExceptionAttr(S, D, Attr);
break;
- case AttributeList::AT_ObjCMethodFamily:
+ case AttributeList::AT_objc_method_family:
handleObjCMethodFamilyAttr(S, D, Attr);
break;
- case AttributeList::AT_ObjCNSObject:handleObjCNSObject (S, D, Attr); break;
- case AttributeList::AT_Blocks: handleBlocksAttr (S, D, Attr); break;
- case AttributeList::AT_Sentinel: handleSentinelAttr (S, D, Attr); break;
- case AttributeList::AT_Const: handleConstAttr (S, D, Attr); break;
- case AttributeList::AT_Pure: handlePureAttr (S, D, Attr); break;
- case AttributeList::AT_Cleanup: handleCleanupAttr (S, D, Attr); break;
- case AttributeList::AT_NoDebug: handleNoDebugAttr (S, D, Attr); break;
- case AttributeList::AT_NoInline: handleNoInlineAttr (S, D, Attr); break;
- case AttributeList::AT_Regparm: handleRegparmAttr (S, D, Attr); break;
+ case AttributeList::AT_NSObject: handleObjCNSObject (S, D, Attr); break;
+ case AttributeList::AT_blocks: handleBlocksAttr (S, D, Attr); break;
+ case AttributeList::AT_sentinel: handleSentinelAttr (S, D, Attr); break;
+ case AttributeList::AT_const: handleConstAttr (S, D, Attr); break;
+ case AttributeList::AT_pure: handlePureAttr (S, D, Attr); break;
+ case AttributeList::AT_cleanup: handleCleanupAttr (S, D, Attr); break;
+ case AttributeList::AT_nodebug: handleNoDebugAttr (S, D, Attr); break;
+ case AttributeList::AT_noinline: handleNoInlineAttr (S, D, Attr); break;
+ case AttributeList::AT_regparm: handleRegparmAttr (S, D, Attr); break;
case AttributeList::IgnoredAttribute:
// Just ignore
break;
- case AttributeList::AT_NoInstrumentFunction: // Interacts with -pg.
+ case AttributeList::AT_no_instrument_function: // Interacts with -pg.
handleNoInstrumentFunctionAttr(S, D, Attr);
break;
- case AttributeList::AT_StdCall:
- case AttributeList::AT_CDecl:
- case AttributeList::AT_FastCall:
- case AttributeList::AT_ThisCall:
- case AttributeList::AT_Pascal:
- case AttributeList::AT_Pcs:
+ case AttributeList::AT_stdcall:
+ case AttributeList::AT_cdecl:
+ case AttributeList::AT_fastcall:
+ case AttributeList::AT_thiscall:
+ case AttributeList::AT_pascal:
+ case AttributeList::AT_pcs:
handleCallConvAttr(S, D, Attr);
break;
- case AttributeList::AT_OpenCLKernel:
+ case AttributeList::AT_opencl_kernel_function:
handleOpenCLKernelAttr(S, D, Attr);
break;
// Microsoft attributes:
- case AttributeList::AT_MsStruct:
+ case AttributeList::AT_ms_struct:
handleMsStructAttr(S, D, Attr);
break;
- case AttributeList::AT_Uuid:
+ case AttributeList::AT_uuid:
handleUuidAttr(S, D, Attr);
break;
- case AttributeList::AT_SingleInheritance:
- case AttributeList::AT_MultipleInheritance:
- case AttributeList::AT_VirtualInheritance:
+ case AttributeList::AT_single_inheritance:
+ case AttributeList::AT_multiple_inheritance:
+ case AttributeList::AT_virtual_inheritance:
handleInheritanceAttr(S, D, Attr);
break;
- case AttributeList::AT_Win64:
- case AttributeList::AT_Ptr32:
- case AttributeList::AT_Ptr64:
+ case AttributeList::AT_w64:
+ case AttributeList::AT_ptr32:
+ case AttributeList::AT_ptr64:
handlePortabilityAttr(S, D, Attr);
break;
- case AttributeList::AT_ForceInline:
+ case AttributeList::AT_forceinline:
handleForceInlineAttr(S, D, Attr);
break;
// Thread safety attributes:
- case AttributeList::AT_GuardedVar:
+ case AttributeList::AT_guarded_var:
handleGuardedVarAttr(S, D, Attr);
break;
- case AttributeList::AT_PtGuardedVar:
+ case AttributeList::AT_pt_guarded_var:
handleGuardedVarAttr(S, D, Attr, /*pointer = */true);
break;
- case AttributeList::AT_ScopedLockable:
+ case AttributeList::AT_scoped_lockable:
handleLockableAttr(S, D, Attr, /*scoped = */true);
break;
- case AttributeList::AT_NoAddressSafetyAnalysis:
+ case AttributeList::AT_no_address_safety_analysis:
handleNoAddressSafetyAttr(S, D, Attr);
break;
- case AttributeList::AT_NoThreadSafetyAnalysis:
+ case AttributeList::AT_no_thread_safety_analysis:
handleNoThreadSafetyAttr(S, D, Attr);
break;
- case AttributeList::AT_Lockable:
+ case AttributeList::AT_lockable:
handleLockableAttr(S, D, Attr);
break;
- case AttributeList::AT_GuardedBy:
+ case AttributeList::AT_guarded_by:
handleGuardedByAttr(S, D, Attr);
break;
- case AttributeList::AT_PtGuardedBy:
+ case AttributeList::AT_pt_guarded_by:
handleGuardedByAttr(S, D, Attr, /*pointer = */true);
break;
- case AttributeList::AT_ExclusiveLockFunction:
+ case AttributeList::AT_exclusive_lock_function:
handleLockFunAttr(S, D, Attr, /*exclusive = */true);
break;
- case AttributeList::AT_ExclusiveLocksRequired:
+ case AttributeList::AT_exclusive_locks_required:
handleLocksRequiredAttr(S, D, Attr, /*exclusive = */true);
break;
- case AttributeList::AT_ExclusiveTrylockFunction:
+ case AttributeList::AT_exclusive_trylock_function:
handleTrylockFunAttr(S, D, Attr, /*exclusive = */true);
break;
- case AttributeList::AT_LockReturned:
+ case AttributeList::AT_lock_returned:
handleLockReturnedAttr(S, D, Attr);
break;
- case AttributeList::AT_LocksExcluded:
+ case AttributeList::AT_locks_excluded:
handleLocksExcludedAttr(S, D, Attr);
break;
- case AttributeList::AT_SharedLockFunction:
+ case AttributeList::AT_shared_lock_function:
handleLockFunAttr(S, D, Attr);
break;
- case AttributeList::AT_SharedLocksRequired:
+ case AttributeList::AT_shared_locks_required:
handleLocksRequiredAttr(S, D, Attr);
break;
- case AttributeList::AT_SharedTrylockFunction:
+ case AttributeList::AT_shared_trylock_function:
handleTrylockFunAttr(S, D, Attr);
break;
- case AttributeList::AT_UnlockFunction:
+ case AttributeList::AT_unlock_function:
handleUnlockFunAttr(S, D, Attr);
break;
- case AttributeList::AT_AcquiredBefore:
+ case AttributeList::AT_acquired_before:
handleAcquireOrderAttr(S, D, Attr, /*before = */true);
break;
- case AttributeList::AT_AcquiredAfter:
+ case AttributeList::AT_acquired_after:
handleAcquireOrderAttr(S, D, Attr, /*before = */false);
break;
@@ -4150,9 +4150,8 @@
// Ask target about the attribute.
const TargetAttributesSema &TargetAttrs = S.getTargetAttributesSema();
if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S))
- S.Diag(Attr.getLoc(), Attr.isDeclspecAttribute() ?
- diag::warn_unhandled_ms_attribute_ignored :
- diag::warn_unknown_attribute_ignored) << Attr.getName();
+ S.Diag(Attr.getLoc(), diag::warn_unknown_attribute_ignored)
+ << Attr.getName();
break;
}
}
@@ -4167,11 +4166,8 @@
if (Attr.isInvalid())
return;
- // Type attributes are still treated as declaration attributes by
- // ParseMicrosoftTypeAttributes and ParseBorlandTypeAttributes. We don't
- // want to process them, however, because we will simply warn about ignoring
- // them. So instead, we will bail out early.
- if (Attr.isMSTypespecAttribute())
+ if (Attr.isDeclspecAttribute() && !isKnownDeclSpecAttr(Attr))
+ // FIXME: Try to deal with other __declspec attributes!
return;
if (NonInheritable)
@@ -4205,7 +4201,7 @@
bool Sema::ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl,
const AttributeList *AttrList) {
for (const AttributeList* l = AttrList; l; l = l->getNext()) {
- if (l->getKind() == AttributeList::AT_Annotate) {
+ if (l->getKind() == AttributeList::AT_annotate) {
handleAnnotateAttr(*this, ASDecl, *l);
} else {
Diag(l->getLoc(), diag::err_only_annotate_after_access_spec);
Modified: cfe/trunk/lib/Sema/SemaStmtAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAttr.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAttr.cpp Tue Jun 19 16:48:43 2012
@@ -48,7 +48,7 @@
static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A,
SourceRange Range) {
switch (A.getKind()) {
- case AttributeList::AT_FallThrough:
+ case AttributeList::AT_fallthrough:
return handleFallThroughAttr(S, St, A, Range);
default:
// if we're here, then we parsed an attribute, but didn't recognize it as a
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Jun 19 16:48:43 2012
@@ -79,16 +79,14 @@
ExprResult Result = SubstExpr(Aligned->getAlignmentExpr(),
TemplateArgs);
if (!Result.isInvalid())
- AddAlignedAttr(Aligned->getLocation(), New, Result.takeAs<Expr>(),
- Aligned->getIsMSDeclSpec());
+ AddAlignedAttr(Aligned->getLocation(), New, Result.takeAs<Expr>());
} else {
TypeSourceInfo *Result = SubstType(Aligned->getAlignmentType(),
TemplateArgs,
Aligned->getLocation(),
DeclarationName());
if (Result)
- AddAlignedAttr(Aligned->getLocation(), New, Result,
- Aligned->getIsMSDeclSpec());
+ AddAlignedAttr(Aligned->getLocation(), New, Result);
}
continue;
}
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Jun 19 16:48:43 2012
@@ -59,12 +59,12 @@
unsigned diagID = 0;
switch (attr.getKind()) {
- case AttributeList::AT_ObjCGC:
+ case AttributeList::AT_objc_gc:
diagID = diag::warn_pointer_attribute_wrong_type;
useExpansionLoc = true;
break;
- case AttributeList::AT_ObjCOwnership:
+ case AttributeList::AT_objc_ownership:
diagID = diag::warn_objc_object_attribute_wrong_type;
useExpansionLoc = true;
break;
@@ -93,19 +93,19 @@
// objc_gc applies to Objective-C pointers or, otherwise, to the
// smallest available pointer type (i.e. 'void*' in 'void**').
#define OBJC_POINTER_TYPE_ATTRS_CASELIST \
- case AttributeList::AT_ObjCGC: \
- case AttributeList::AT_ObjCOwnership
+ case AttributeList::AT_objc_gc: \
+ case AttributeList::AT_objc_ownership
// Function type attributes.
#define FUNCTION_TYPE_ATTRS_CASELIST \
- case AttributeList::AT_NoReturn: \
- case AttributeList::AT_CDecl: \
- case AttributeList::AT_FastCall: \
- case AttributeList::AT_StdCall: \
- case AttributeList::AT_ThisCall: \
- case AttributeList::AT_Pascal: \
- case AttributeList::AT_Regparm: \
- case AttributeList::AT_Pcs \
+ case AttributeList::AT_noreturn: \
+ case AttributeList::AT_cdecl: \
+ case AttributeList::AT_fastcall: \
+ case AttributeList::AT_stdcall: \
+ case AttributeList::AT_thiscall: \
+ case AttributeList::AT_pascal: \
+ case AttributeList::AT_regparm: \
+ case AttributeList::AT_pcs \
namespace {
/// An object which stores processing state for the entire
@@ -284,9 +284,9 @@
static bool handleObjCPointerTypeAttr(TypeProcessingState &state,
AttributeList &attr, QualType &type) {
- if (attr.getKind() == AttributeList::AT_ObjCGC)
+ if (attr.getKind() == AttributeList::AT_objc_gc)
return handleObjCGCTypeAttr(state, attr, type);
- assert(attr.getKind() == AttributeList::AT_ObjCOwnership);
+ assert(attr.getKind() == AttributeList::AT_objc_ownership);
return handleObjCOwnershipTypeAttr(state, attr, type);
}
@@ -505,7 +505,7 @@
distributeObjCPointerTypeAttrFromDeclarator(state, *attr, declSpecType);
break;
- case AttributeList::AT_NSReturnsRetained:
+ case AttributeList::AT_ns_returns_retained:
if (!state.getSema().getLangOpts().ObjCAutoRefCount)
break;
// fallthrough
@@ -1719,7 +1719,7 @@
return;
for (const AttributeList *attr = chunk.getAttrs(); attr;
attr = attr->getNext())
- if (attr->getKind() == AttributeList::AT_ObjCOwnership)
+ if (attr->getKind() == AttributeList::AT_objc_ownership)
return;
transferARCOwnershipToDeclaratorChunk(state, Qualifiers::OCL_Autoreleasing,
@@ -2280,7 +2280,7 @@
bool Overloadable = false;
for (const AttributeList *Attrs = D.getAttributes();
Attrs; Attrs = Attrs->getNext()) {
- if (Attrs->getKind() == AttributeList::AT_Overloadable) {
+ if (Attrs->getKind() == AttributeList::AT_overloadable) {
Overloadable = true;
break;
}
@@ -2710,7 +2710,7 @@
DeclaratorChunk &chunk = D.getTypeObject(chunkIndex);
for (const AttributeList *attr = chunk.getAttrs(); attr;
attr = attr->getNext())
- if (attr->getKind() == AttributeList::AT_ObjCOwnership)
+ if (attr->getKind() == AttributeList::AT_objc_ownership)
return;
const char *attrStr = 0;
@@ -2806,33 +2806,33 @@
static AttributeList::Kind getAttrListKind(AttributedType::Kind kind) {
switch (kind) {
case AttributedType::attr_address_space:
- return AttributeList::AT_AddressSpace;
+ return AttributeList::AT_address_space;
case AttributedType::attr_regparm:
- return AttributeList::AT_Regparm;
+ return AttributeList::AT_regparm;
case AttributedType::attr_vector_size:
- return AttributeList::AT_VectorSize;
+ return AttributeList::AT_vector_size;
case AttributedType::attr_neon_vector_type:
- return AttributeList::AT_NeonVectorType;
+ return AttributeList::AT_neon_vector_type;
case AttributedType::attr_neon_polyvector_type:
- return AttributeList::AT_NeonPolyVectorType;
+ return AttributeList::AT_neon_polyvector_type;
case AttributedType::attr_objc_gc:
- return AttributeList::AT_ObjCGC;
+ return AttributeList::AT_objc_gc;
case AttributedType::attr_objc_ownership:
- return AttributeList::AT_ObjCOwnership;
+ return AttributeList::AT_objc_ownership;
case AttributedType::attr_noreturn:
- return AttributeList::AT_NoReturn;
+ return AttributeList::AT_noreturn;
case AttributedType::attr_cdecl:
- return AttributeList::AT_CDecl;
+ return AttributeList::AT_cdecl;
case AttributedType::attr_fastcall:
- return AttributeList::AT_FastCall;
+ return AttributeList::AT_fastcall;
case AttributedType::attr_stdcall:
- return AttributeList::AT_StdCall;
+ return AttributeList::AT_stdcall;
case AttributedType::attr_thiscall:
- return AttributeList::AT_ThisCall;
+ return AttributeList::AT_thiscall;
case AttributedType::attr_pascal:
- return AttributeList::AT_Pascal;
+ return AttributeList::AT_pascal;
case AttributedType::attr_pcs:
- return AttributeList::AT_Pcs;
+ return AttributeList::AT_pcs;
}
llvm_unreachable("unexpected attribute kind!");
}
@@ -3667,7 +3667,7 @@
FunctionTypeUnwrapper unwrapped(S, type);
- if (attr.getKind() == AttributeList::AT_NoReturn) {
+ if (attr.getKind() == AttributeList::AT_noreturn) {
if (S.CheckNoReturnAttr(attr))
return true;
@@ -3683,7 +3683,7 @@
// ns_returns_retained is not always a type attribute, but if we got
// here, we're treating it as one right now.
- if (attr.getKind() == AttributeList::AT_NSReturnsRetained) {
+ if (attr.getKind() == AttributeList::AT_ns_returns_retained) {
assert(S.getLangOpts().ObjCAutoRefCount &&
"ns_returns_retained treated as type attribute in non-ARC");
if (attr.getNumArgs()) return true;
@@ -3698,7 +3698,7 @@
return true;
}
- if (attr.getKind() == AttributeList::AT_Regparm) {
+ if (attr.getKind() == AttributeList::AT_regparm) {
unsigned value;
if (S.CheckRegparmAttr(attr, value))
return true;
@@ -3986,12 +3986,12 @@
switch (attr.getKind()) {
default: break;
- case AttributeList::AT_MayAlias:
+ case AttributeList::AT_may_alias:
// FIXME: This attribute needs to actually be handled, but if we ignore
// it it breaks large amounts of Linux software.
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_AddressSpace:
+ case AttributeList::AT_address_space:
HandleAddressSpaceTypeAttribute(type, attr, state.getSema());
attr.setUsedAsTypeAttr();
break;
@@ -4000,40 +4000,40 @@
distributeObjCPointerTypeAttr(state, attr, type);
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_VectorSize:
+ case AttributeList::AT_vector_size:
HandleVectorSizeAttr(type, attr, state.getSema());
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_ExtVectorType:
+ case AttributeList::AT_ext_vector_type:
if (state.getDeclarator().getDeclSpec().getStorageClassSpec()
!= DeclSpec::SCS_typedef)
HandleExtVectorTypeAttr(type, attr, state.getSema());
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_NeonVectorType:
+ case AttributeList::AT_neon_vector_type:
HandleNeonVectorTypeAttr(type, attr, state.getSema(),
VectorType::NeonVector, "neon_vector_type");
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_NeonPolyVectorType:
+ case AttributeList::AT_neon_polyvector_type:
HandleNeonVectorTypeAttr(type, attr, state.getSema(),
VectorType::NeonPolyVector,
"neon_polyvector_type");
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_OpenCLImageAccess:
+ case AttributeList::AT_opencl_image_access:
HandleOpenCLImageAccessAttribute(type, attr, state.getSema());
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_Win64:
- case AttributeList::AT_Ptr32:
- case AttributeList::AT_Ptr64:
+ case AttributeList::AT_w64:
+ case AttributeList::AT_ptr32:
+ case AttributeList::AT_ptr64:
// FIXME: don't ignore these
attr.setUsedAsTypeAttr();
break;
- case AttributeList::AT_NSReturnsRetained:
+ case AttributeList::AT_ns_returns_retained:
if (!state.getSema().getLangOpts().ObjCAutoRefCount)
break;
// fallthrough into the function attrs
Modified: cfe/trunk/lib/Sema/TargetAttributesSema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TargetAttributesSema.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TargetAttributesSema.cpp (original)
+++ cfe/trunk/lib/Sema/TargetAttributesSema.cpp Tue Jun 19 16:48:43 2012
@@ -244,9 +244,9 @@
if (Triple.getOS() == llvm::Triple::Win32 ||
Triple.getOS() == llvm::Triple::MinGW32) {
switch (Attr.getKind()) {
- case AttributeList::AT_DLLImport: HandleDLLImportAttr(D, Attr, S);
+ case AttributeList::AT_dllimport: HandleDLLImportAttr(D, Attr, S);
return true;
- case AttributeList::AT_DLLExport: HandleDLLExportAttr(D, Attr, S);
+ case AttributeList::AT_dllexport: HandleDLLExportAttr(D, Attr, S);
return true;
default: break;
}
Modified: cfe/trunk/test/CodeGen/ms-declspecs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-declspecs.c?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-declspecs.c (original)
+++ cfe/trunk/test/CodeGen/ms-declspecs.c Tue Jun 19 16:48:43 2012
@@ -1,13 +1,5 @@
// RUN: %clang_cc1 -triple i386-pc-win32 %s -emit-llvm -fms-compatibility -o - | FileCheck %s
-struct __declspec(align(16)) S {
- char x;
-};
-union { struct S s; } u;
-
-// CHECK: @u = {{.*}}zeroinitializer, align 16
-
-
// CHECK: define void @t3() nounwind noinline naked {
__declspec(naked) void t3() {}
Modified: cfe/trunk/test/Parser/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.c Tue Jun 19 16:48:43 2012
@@ -3,10 +3,10 @@
int __stdcall func();
typedef int (__cdecl *tptr)();
void (*__fastcall fastpfunc)();
-struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; /* expected-warning{{__declspec attribute 'novtable' is not supported}} */
+struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
extern __declspec(dllimport) void __stdcall VarR4FromDec();
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
-__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); /* expected-warning{{__declspec attribute 'noalias' is not supported}} expected-warning{{__declspec attribute 'restrict' is not supported}} */
+__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
void * __ptr64 PtrToPtr64(const void *p)
@@ -69,7 +69,7 @@
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
struct SA_Post{ SA_Post(); int attr; };
-[returnvalue:SA_Post( attr=1)]
+[returnvalue:SA_Post( attr=1)]
int foo1([SA_Post(attr=1)] void *param);
@@ -80,25 +80,3 @@
__assume(a);
__debugbreak();
}
-
-struct __declspec(frobble) S1 {}; /* expected-warning {{unknown __declspec attribute 'frobble' ignored}} */
-struct __declspec(12) S2 {}; /* expected-error {{__declspec attributes must be an identifier or string literal}} */
-struct __declspec("testing") S3 {}; /* expected-warning {{__declspec attribute '"testing"' is not supported}} */
-
-/* Ensure multiple declspec attributes are supported */
-struct __declspec(align(8) deprecated) S4 {};
-
-/* But multiple declspecs must still be legal */
-struct __declspec(deprecated frobble "testing") S5 {}; /* expected-warning {{unknown __declspec attribute 'frobble' ignored}} expected-warning {{__declspec attribute '"testing"' is not supported}} */
-struct __declspec(unknown(12) deprecated) S6 {}; /* expected-warning {{unknown __declspec attribute 'unknown' ignored}}*/
-
-struct S7 {
- int foo() { return 12; }
- __declspec(property(get=foo) deprecated) int t;
-};
-
-/* Technically, this is legal (though it does nothing) */
-__declspec() void quux( void ) {
- struct S7 s;
- int i = s.t; /* expected-warning {{'t' is deprecated}} */
-}
Modified: cfe/trunk/test/Sema/MicrosoftCompatibility.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftCompatibility.c?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/test/Sema/MicrosoftCompatibility.c (original)
+++ cfe/trunk/test/Sema/MicrosoftCompatibility.c Tue Jun 19 16:48:43 2012
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-compatibility
-enum ENUM1; // expected-warning {{forward references to 'enum' types are a Microsoft extension}}
+enum ENUM1; // expected-warning {{forward references to 'enum' types are a Microsoft extension}}
enum ENUM1 var1 = 3;
enum ENUM1* var2 = 0;
@@ -14,8 +14,3 @@
__declspec(noreturn) void f6( void ) {
return; // expected-warning {{function 'f6' declared 'noreturn' should not return}}
}
-
-__declspec(align(32768)) struct S1 { int a; } s; /* expected-error {{requested alignment must be 8192 bytes or smaller}} */
-struct __declspec(aligned) S2 {}; /* expected-warning {{unknown __declspec attribute 'aligned' ignored}} */
-
-struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */
\ No newline at end of file
Modified: cfe/trunk/test/Sema/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftExtensions.c?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/test/Sema/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Sema/MicrosoftExtensions.c Tue Jun 19 16:48:43 2012
@@ -93,8 +93,6 @@
#define MY_TEXT "This is also deprecated"
__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}
-struct __declspec(deprecated(123)) DS2 {}; // expected-error {{argument to deprecated attribute was not a string literal}}
-
void test( void ) {
e1 = one; // expected-warning {{'e1' is deprecated: This is deprecated}}
struct DS1 s = { 0 }; // expected-warning {{'DS1' is deprecated}}
Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=158749&r1=158748&r2=158749&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Jun 19 16:48:43 2012
@@ -769,7 +769,7 @@
continue;
std::vector<Record*> ArgRecords = R.getValueAsListOfDefs("Args");
- std::vector<Record*> Spellings = R.getValueAsListOfDefs("Spellings");
+ std::vector<StringRef> Spellings = getValueAsListOfStrings(R, "Spellings");
std::vector<Argument*> Args;
for (ri = ArgRecords.begin(), re = ArgRecords.end(); ri != re; ++ri)
Args.push_back(createArgument(**ri, R.getName()));
@@ -789,10 +789,9 @@
OS << "void " << R.getName() << "Attr::printPretty("
<< "llvm::raw_ostream &OS, ASTContext &Ctx) const {\n";
if (Spellings.begin() != Spellings.end()) {
- StringRef Spelling = (*Spellings.begin())->getValueAsString("Name");
- OS << " OS << \" __attribute__((" << Spelling;
+ OS << " OS << \" __attribute__((" << *Spellings.begin();
if (Args.size()) OS << "(";
- if (Spelling == "availability") {
+ if (*Spellings.begin()=="availability") {
writeAvailabilityValue(OS);
} else {
for (ai = Args.begin(); ai != ae; ++ai) {
@@ -963,10 +962,11 @@
for (std::vector<Record*>::iterator I = Attrs.begin(), E = Attrs.end(); I != E; ++I) {
Record &Attr = **I;
- std::vector<Record*> Spellings = Attr.getValueAsListOfDefs("Spellings");
+ std::vector<StringRef> Spellings = getValueAsListOfStrings(Attr, "Spellings");
- for (std::vector<Record*>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) {
- OS << ".Case(\"" << (*I)->getValueAsString("Name") << "\", true)\n";
+ for (std::vector<StringRef>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) {
+ StringRef Spelling = *I;
+ OS << ".Case(\"" << Spelling << "\", true)\n";
}
}
@@ -985,16 +985,12 @@
bool LateParsed = Attr.getValueAsBit("LateParsed");
if (LateParsed) {
- std::vector<Record*> Spellings =
- Attr.getValueAsListOfDefs("Spellings");
+ std::vector<StringRef> Spellings =
+ getValueAsListOfStrings(Attr, "Spellings");
- // FIXME: Handle non-GNU attributes
- for (std::vector<Record*>::const_iterator I = Spellings.begin(),
+ for (std::vector<StringRef>::const_iterator I = Spellings.begin(),
E = Spellings.end(); I != E; ++I) {
- if ((*I)->getValueAsString("Variety") != "GNU")
- continue;
- OS << ".Case(\"" << (*I)->getValueAsString("Name") << "\", "
- << LateParsed << ")\n";
+ OS << ".Case(\"" << (*I) << "\", " << LateParsed << ")\n";
}
}
}
@@ -1073,9 +1069,6 @@
<< "} // end namespace clang\n";
}
-}
-#include <cstdio>
-namespace clang {
// Emits the list of parsed attributes.
void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
OS << "// This file is generated by TableGen. Do not edit.\n\n";
@@ -1085,6 +1078,7 @@
OS << "#endif\n\n";
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
+ std::set<StringRef> ProcessedAttrs;
for (std::vector<Record*>::iterator I = Attrs.begin(), E = Attrs.end();
I != E; ++I) {
@@ -1094,21 +1088,24 @@
bool DistinctSpellings = Attr.getValueAsBit("DistinctSpellings");
if (SemaHandler) {
- if (DistinctSpellings) {
- std::vector<Record*> Spellings = Attr.getValueAsListOfDefs("Spellings");
-
- for (std::vector<Record*>::const_iterator I = Spellings.begin(),
- E = Spellings.end(); I != E; ++I) {
- std::string AttrName = (*I)->getValueAsString("Name");
-
- StringRef Spelling = NormalizeAttrName(AttrName);
+ std::vector<StringRef> Spellings =
+ getValueAsListOfStrings(Attr, "Spellings");
+
+ for (std::vector<StringRef>::const_iterator I = Spellings.begin(),
+ E = Spellings.end(); I != E; ++I) {
+ StringRef AttrName = *I;
- OS << "PARSED_ATTR(" << Spelling << ")\n";
- }
- } else {
- StringRef AttrName = Attr.getName();
AttrName = NormalizeAttrName(AttrName);
+ // skip if a normalized version has been processed.
+ if (ProcessedAttrs.find(AttrName) != ProcessedAttrs.end())
+ continue;
+ else
+ ProcessedAttrs.insert(AttrName);
+
OS << "PARSED_ATTR(" << AttrName << ")\n";
+
+ if (!DistinctSpellings)
+ break;
}
}
}
@@ -1130,31 +1127,46 @@
bool Ignored = Attr.getValueAsBit("Ignored");
bool DistinctSpellings = Attr.getValueAsBit("DistinctSpellings");
if (SemaHandler || Ignored) {
- std::vector<Record*> Spellings = Attr.getValueAsListOfDefs("Spellings");
+ std::vector<StringRef> Spellings =
+ getValueAsListOfStrings(Attr, "Spellings");
+ std::vector<StringRef> Namespaces =
+ getValueAsListOfStrings(Attr, "Namespaces");
- for (std::vector<Record*>::const_iterator I = Spellings.begin(),
+ for (std::vector<StringRef>::const_iterator I = Spellings.begin(),
E = Spellings.end(); I != E; ++I) {
- std::string RawSpelling = (*I)->getValueAsString("Name");
StringRef AttrName = NormalizeAttrName(DistinctSpellings
- ? StringRef(RawSpelling)
- : StringRef(Attr.getName()));
-
- SmallString<64> Spelling;
- if ((*I)->getValueAsString("Variety") == "CXX11") {
- Spelling += (*I)->getValueAsString("Namespace");
- Spelling += "::";
+ ? *I
+ : Spellings.front());
+ StringRef Spelling = NormalizeAttrSpelling(*I);
+
+ for (std::vector<StringRef>::const_iterator NI = Namespaces.begin(),
+ NE = Namespaces.end(); NI != NE; ++NI) {
+ SmallString<64> Buf;
+ Buf += *NI;
+ Buf += "::";
+ Buf += Spelling;
+
+ if (SemaHandler)
+ Matches.push_back(
+ StringMatcher::StringPair(
+ Buf.str(),
+ "return AttributeList::AT_" + AttrName.str() + ";"));
+ else
+ Matches.push_back(
+ StringMatcher::StringPair(
+ Buf.str(),
+ "return AttributeList::IgnoredAttribute;"));
}
- Spelling += NormalizeAttrSpelling(RawSpelling);
if (SemaHandler)
Matches.push_back(
StringMatcher::StringPair(
- StringRef(Spelling),
+ Spelling,
"return AttributeList::AT_" + AttrName.str() + ";"));
else
Matches.push_back(
StringMatcher::StringPair(
- StringRef(Spelling),
+ Spelling,
"return AttributeList::IgnoredAttribute;"));
}
}
More information about the cfe-commits
mailing list