diff options
Diffstat (limited to 'include/clang/Basic')
25 files changed, 1472 insertions, 108 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td new file mode 100644 index 0000000..98871d2 --- /dev/null +++ b/include/clang/Basic/Attr.td @@ -0,0 +1,382 @@ +//////////////////////////////////////////////////////////////////////////////// +// Note: This file is a work in progress. Please do not apply non-trivial +// updates unless you have talked to Sean Hunt <rideau3@gmail.com> prior. +// Merely adding a new attribute is a trivial update. +//////////////////////////////////////////////////////////////////////////////// + +// An attribute's subject is whatever it appertains to. In this file, it is +// more accurately a list of things that an attribute can appertain to. All +// Decls and Stmts are possibly AttrSubjects (even though the syntax may not +// allow attributes on a given Decl or Stmt). +class AttrSubject; + +include "clang/Basic/DeclNodes.td" +include "clang/Basic/StmtNodes.td" + +// A subset-subject is an AttrSubject constrained to operate only on some subset +// of that subject. +// +// The description is used in output messages to specify what the subject +// represents. FIXME: Deal with translation issues. +// +// The code fragment is a boolean expression that will confirm that the subject +// meets the requirements; the subject will have the name S, and will have the +// type specified by the base. It should be a simple boolean expression. +class SubsetSubject<AttrSubject base, string description, code check> + : AttrSubject { + AttrSubject Base = base; + string Description = description; + code CheckCode = check; +} + +// This is the type of a variable which C++0x defines [[aligned()]] as being +// a possible subject. +def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable", + [{S->getStorageClass() != VarDecl::Register && + S->getKind() != Decl::ImplicitParam + S->getKind() != Decl::ParmVar + S->getKind() != Decl::NonTypeTemplateParm}]>; +def CXXVirtualMethod : SubsetSubject<CXXRecord, "virtual member function", + [{S->isVirtual()}]>; +def NonBitField : SubsetSubject<Field, "non-bit field", + [{!S->isBitField()}]>; + +// A single argument to an attribute +class Argument<string name> { + string Name = name; +} + +class IdentifierArgument<string name> : Argument<name>; +class IntArgument<string name> : Argument<name>; +class StringArgument<string name> : Argument<name>; +class ExprArgument<string name> : Argument<name>; +class FunctionArgument<string name> : Argument<name>; +class ObjCInterfaceArgument<string name> : Argument<name>; +class UnsignedIntArgument<string name> : Argument<name>; +class UnsignedIntOrTypeArgument<string name> : Argument<name>; + +// An integer argument with a default value +class DefaultIntArgument<string name, int default> : IntArgument<name> { + int Default = default; +} + +// Zero or more arguments of a type +class VariadicArgument<Argument arg> : Argument<arg.Name> { + Argument VariadicArg = arg; +} + +class Attr { + // The various ways in which an attribute can be spelled in source + 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 = []; + // A temporary development bit to tell TableGen not to emit certain + // information about the attribute. + bit DoNotEmit = 1; +} + +// +// Attributes begin here +// + +def Alias : Attr { + let Spellings = ["alias"]; + let Args = [StringArgument<"AliasName">]; +} + +def Aligned : Attr { + let Spellings = ["align", "aligned"]; + let Subjects = [NonBitField, NormalVar, Tag]; + let Args = [UnsignedIntOrTypeArgument<"Alignment">]; + let Namespaces = ["", "std"]; +} + +def AlignMac68k : Attr { + let Spellings = []; +} + +def AlwaysInline : Attr { + let Spellings = ["always_inline"]; +} + +def AnalyzerNoReturn : Attr { + let Spellings = ["analyzer_noreturn"]; +} + +def Annotate : Attr { + let Spellings = ["annotate"]; + let Args = [StringArgument<"Annotation">]; +} + +def AsmLabel : Attr { + let Spellings = []; + let Args = [StringArgument<"Label">]; +} + +def BaseCheck : Attr { + let Spellings = ["base_check"]; + let Subjects = [CXXRecord]; + let Namespaces = ["", "std"]; + let DoNotEmit = 0; +} + +def Blocks : Attr { + let Spellings = ["blocks"]; + let Args = [IdentifierArgument<"Type">]; +} + +def CarriesDependency : Attr { + let Spellings = ["carries_dependency"]; + let Subjects = [ParmVar, Function]; + let Namespaces = ["", "std"]; + let DoNotEmit = 0; +} + +def CDecl : Attr { + let Spellings = ["cdecl", "__cdecl"]; +} + +def CFReturnsRetained : Attr { + let Spellings = ["cf_returns_retained"]; +} + +def CFReturnsNotRetained : Attr { + let Spellings = ["cf_returns_not_retained"]; +} + +def Cleanup : Attr { + let Spellings = ["cleanup"]; + let Args = [FunctionArgument<"FunctionDecl">]; +} + +def Const : Attr { + let Spellings = ["const"]; +} + +def Constructor : Attr { + let Spellings = ["constructor"]; + let Args = [IntArgument<"Priority">]; +} + +def Deprecated : Attr { + let Spellings = ["deprecated"]; +} + +def Destructor : Attr { + let Spellings = ["destructor"]; + let Args = [IntArgument<"Priority">]; +} + +def DLLExport : Attr { + let Spellings = ["dllexport"]; +} + +def DLLImport : Attr { + let Spellings = ["dllimport"]; +} + +def FastCall : Attr { + let Spellings = ["fastcall", "__fastcall"]; +} + +def Final : Attr { + let Spellings = ["final"]; + let Subjects = [CXXRecord, CXXVirtualMethod]; + let Namespaces = ["", "std"]; + let DoNotEmit = 0; +} + +def Format : Attr { + let Spellings = ["format"]; + let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">, + IntArgument<"FirstArg">]; +} + +def FormatArg : Attr { + let Spellings = ["format_arg"]; + let Args = [IntArgument<"FormatIdx">]; +} + +def GNUInline : Attr { + let Spellings = ["gnu_inline"]; +} + +def Hiding : Attr { + let Spellings = ["hiding"]; + let Subjects = [Field, CXXMethod]; + let Namespaces = ["", "std"]; + let DoNotEmit = 0; +} + +def IBAction : Attr { + let Spellings = ["ibaction"]; +} + +def IBOutlet : Attr { + let Spellings = ["iboutlet"]; +} + +def IBOutletCollection : Attr { + let Spellings = ["iboutletcollection"]; + let Args = [ObjCInterfaceArgument<"Class">]; +} + +def Malloc : Attr { + let Spellings = ["malloc"]; +} + +def MaxFieldAlignment : Attr { + let Spellings = []; + let Args = [UnsignedIntArgument<"Alignment">]; +} + +def MSP430Interrupt : Attr { + let Spellings = []; + let Args = [UnsignedIntArgument<"Number">]; +} + +def NoDebug : Attr { + let Spellings = ["nodebug"]; +} + +def NoInline : Attr { + let Spellings = ["noinline"]; +} + +def NonNull : Attr { + let Spellings = ["nonnull"]; + let Args = [VariadicArgument<UnsignedIntArgument<"Args">>]; +} + +def NoReturn : Attr { + let Spellings = ["noreturn"]; + // FIXME: Does GCC allow this on the function instead? + let Subjects = [Function]; + let Namespaces = ["", "std"]; +} + +def NoInstrumentFunction : Attr { + let Spellings = ["no_instrument_function"]; + let Subjects = [Function]; +} + +def NoThrow : Attr { + let Spellings = ["nothrow"]; +} + +def NSReturnsRetained : Attr { + let Spellings = ["ns_returns_retained"]; +} + +def NSReturnsNotRetained : Attr { + let Spellings = ["ns_returns_not_retained"]; +} + +def ObjCException : Attr { + let Spellings = ["objc_exception"]; +} + +def ObjCNSObject : Attr { + let Spellings = ["NSOjbect"]; +} + +def Override : Attr { + let Spellings = ["override"]; + let Subjects = [CXXVirtualMethod]; + let Namespaces = ["", "std"]; + let DoNotEmit = 0; +} + +def Overloadable : Attr { + let Spellings = ["overloadable"]; +} + +def Packed : Attr { + let Spellings = ["packed"]; +} + +def Pure : Attr { + let Spellings = ["pure"]; +} + +def Regparm : Attr { + let Spellings = ["regparm"]; + let Args = [UnsignedIntArgument<"NumParams">]; +} + +def ReqdWorkGroupSize : Attr { + let Spellings = ["reqd_work_group_size"]; + let Args = [UnsignedIntArgument<"XDim">, UnsignedIntArgument<"YDim">, + UnsignedIntArgument<"ZDim">]; +} + +def InitPriority : Attr { + let Spellings = ["init_priority"]; + let Args = [UnsignedIntArgument<"Priority">]; +} + +def Section : Attr { + let Spellings = ["section"]; + let Args = [StringArgument<"Name">]; +} + +def Sentinel : Attr { + let Spellings = ["sentinel"]; + let Args = [DefaultIntArgument<"NulPos", 0>, + DefaultIntArgument<"Sentinel", 0>]; +} + +def StdCall : Attr { + let Spellings = ["stdcall", "__stdcall"]; +} + +def ThisCall : Attr { + let Spellings = ["thiscall", "__thiscall"]; +} + +def TransparentUnion : Attr { + let Spellings = ["transparent_union"]; +} + +def Unavailable : Attr { + let Spellings = ["unavailable"]; +} + +def Unused : Attr { + let Spellings = ["unused"]; +} + +def Used : Attr { + let Spellings = ["used"]; +} + +def Visibility : Attr { + let Spellings = ["visibility"]; + let Args = [StringArgument<"Visibility">]; +} + +def WarnUnusedResult : Attr { + let Spellings = ["warn_unused_result"]; +} + +def Weak : Attr { + let Spellings = ["weak"]; +} + +def WeakImport : Attr { + let Spellings = ["weak_import"]; +} + +def WeakRef : Attr { + let Spellings = ["weakref"]; +} + +def X86ForceAlignArgPointer : Attr { + let Spellings = []; +} diff --git a/include/clang/Basic/AttrKinds.h b/include/clang/Basic/AttrKinds.h new file mode 100644 index 0000000..822573b --- /dev/null +++ b/include/clang/Basic/AttrKinds.h @@ -0,0 +1,31 @@ +//===----- Attr.h - Enum values for C Attribute Kinds ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the attr::Kind enum +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_ATTRKINDS_H +#define LLVM_CLANG_ATTRKINDS_H + +namespace clang { + +namespace attr { + +// Kind - This is a list of all the recognized kinds of attributes. +enum Kind { +#define ATTR(X) X, +#include "clang/Basic/AttrList.inc" + NUM_ATTRS +}; + +} // end namespace attr +} // end namespace clang + +#endif diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index b306954..cad2824 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -540,6 +540,7 @@ LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h") // id objc_msgSend(id, SEL) // but we need new type letters for that. LIBBUILTIN(objc_msgSend, "v*.", "f", "objc/message.h") +BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") // Builtin math library functions LIBBUILTIN(pow, "ddd", "fe", "math.h") diff --git a/include/clang/Basic/BuiltinsARM.def b/include/clang/Basic/BuiltinsARM.def index 4973076a..54e4c2b 100644 --- a/include/clang/Basic/BuiltinsARM.def +++ b/include/clang/Basic/BuiltinsARM.def @@ -14,7 +14,13 @@ // The format of this database matches clang/Basic/Builtins.def. -// FIXME: This is just a placeholder. NEON intrinsics should be listed here. +// In libgcc +BUILTIN(__clear_cache, "vc*c*", "") BUILTIN(__builtin_thread_pointer, "v*", "") +// NEON +#define GET_NEON_BUILTINS +#include "clang/Basic/arm_neon.inc" +#undef GET_NEON_BUILTINS + #undef BUILTIN diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def index 287bba9..e0518dc 100644 --- a/include/clang/Basic/BuiltinsPPC.def +++ b/include/clang/Basic/BuiltinsPPC.def @@ -18,14 +18,6 @@ // The format of this database matches clang/Basic/Builtins.def. // This is just a placeholder, the types and attributes are wrong. -BUILTIN(__builtin_altivec_abs_v16qi, "V16UcV16Sc", "") -BUILTIN(__builtin_altivec_abs_v8hi, "V8UsV8Ss", "") -BUILTIN(__builtin_altivec_abs_v4si, "V4UiV4Si", "") - -BUILTIN(__builtin_altivec_abss_v16qi, "V16UcV16Sc", "") -BUILTIN(__builtin_altivec_abss_v8hi, "V8UsV8Ss", "") -BUILTIN(__builtin_altivec_abss_v4si, "V4UiV4Si", "") - BUILTIN(__builtin_altivec_vaddcuw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vaddsbs, "V16ScV16ScV16Sc", "") @@ -49,6 +41,67 @@ BUILTIN(__builtin_altivec_vavguh, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_vavgsw, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "") + +BUILTIN(__builtin_altivec_vcfsx, "V4fV4ii", "") +BUILTIN(__builtin_altivec_vcfux, "V4fV4ii", "") +BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fi", "") +BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "") + +BUILTIN(__builtin_altivec_dss, "vUi", "") +BUILTIN(__builtin_altivec_dssall, "v", "") +BUILTIN(__builtin_altivec_dst, "vv*iUi", "") +BUILTIN(__builtin_altivec_dstt, "vv*iUi", "") +BUILTIN(__builtin_altivec_dstst, "vv*iUi", "") +BUILTIN(__builtin_altivec_dststt, "vv*iUi", "") + +BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "") + +BUILTIN(__builtin_altivec_vrfim, "V4fV4f", "") + +BUILTIN(__builtin_altivec_lvx, "V4iiv*", "") +BUILTIN(__builtin_altivec_lvxl, "V4iiv*", "") +BUILTIN(__builtin_altivec_lvebx, "V16civ*", "") +BUILTIN(__builtin_altivec_lvehx, "V8siv*", "") +BUILTIN(__builtin_altivec_lvewx, "V4iiv*", "") + +BUILTIN(__builtin_altivec_vlogefp, "V4fV4f", "") + +BUILTIN(__builtin_altivec_lvsl, "V16cUcv*", "") +BUILTIN(__builtin_altivec_lvsr, "V16cUcv*", "") + +BUILTIN(__builtin_altivec_vmaddfp, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_altivec_vmhaddshs, "V8sV8sV8sV8s", "") +BUILTIN(__builtin_altivec_vmhraddshs, "V8sV8sV8sV8s", "") + +BUILTIN(__builtin_altivec_vmsumubm, "V4UiV16UcV16UcV4Ui", "") +BUILTIN(__builtin_altivec_vmsummbm, "V4SiV16ScV16UcV4Si", "") +BUILTIN(__builtin_altivec_vmsumuhm, "V4UiV8UsV8UsV4Ui", "") +BUILTIN(__builtin_altivec_vmsumshm, "V4SiV8SsV8SsV4Si", "") +BUILTIN(__builtin_altivec_vmsumuhs, "V4UiV8UsV8UsV4Ui", "") +BUILTIN(__builtin_altivec_vmsumshs, "V4SiV8SsV8SsV4Si", "") + +BUILTIN(__builtin_altivec_vmuleub, "V8UsV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vmulesb, "V8SsV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vmuleuh, "V4UiV8UsV8Us", "") +BUILTIN(__builtin_altivec_vmulesh, "V4SiV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vmuloub, "V8UsV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vmulosb, "V8SsV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vmulouh, "V4UiV8UsV8Us", "") +BUILTIN(__builtin_altivec_vmulosh, "V4SiV8SsV8Ss", "") + +BUILTIN(__builtin_altivec_vnmsubfp, "V4fV4fV4fV4f", "") + +BUILTIN(__builtin_altivec_vpkpx, "V8sV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vpkuhus, "V16UcV8UsV8Us", "") +BUILTIN(__builtin_altivec_vpkshss, "V16ScV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vpkuwus, "V8UsV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vpkswss, "V8SsV4SiV4Si", "") +BUILTIN(__builtin_altivec_vpkshus, "V16UcV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vpkswus, "V8UsV4SiV4Si", "") + +BUILTIN(__builtin_altivec_vperm_4si, "V4iV4iV4iV16Uc", "") + BUILTIN(__builtin_altivec_stvx, "vV4iiv*", "") BUILTIN(__builtin_altivec_stvxl, "vV4iiv*", "") BUILTIN(__builtin_altivec_stvebx, "vV16civ*", "") @@ -92,6 +145,48 @@ BUILTIN(__builtin_altivec_vminfp, "V4fV4fV4f", "") BUILTIN(__builtin_altivec_mtvscr, "vV4i", "") +BUILTIN(__builtin_altivec_vrefp, "V4fV4f", "") + +BUILTIN(__builtin_altivec_vrlb, "V16cV16cV16Uc", "") +BUILTIN(__builtin_altivec_vrlh, "V8sV8sV8Us", "") +BUILTIN(__builtin_altivec_vrlw, "V4iV4iV4Ui", "") + +BUILTIN(__builtin_altivec_vsel_4si, "V4iV4iV4iV4Ui", "") + +BUILTIN(__builtin_altivec_vsl, "V4iV4iV4i", "") +BUILTIN(__builtin_altivec_vslo, "V4iV4iV4i", "") + +BUILTIN(__builtin_altivec_vsrab, "V16cV16cV16Uc", "") +BUILTIN(__builtin_altivec_vsrah, "V8sV8sV8Us", "") +BUILTIN(__builtin_altivec_vsraw, "V4iV4iV4Ui", "") + +BUILTIN(__builtin_altivec_vsr, "V4iV4iV4i", "") +BUILTIN(__builtin_altivec_vsro, "V4iV4iV4i", "") + +BUILTIN(__builtin_altivec_vrfin, "V4fV4f", "") + +BUILTIN(__builtin_altivec_vrsqrtefp, "V4fV4f", "") + +BUILTIN(__builtin_altivec_vsubcuw, "V4UiV4UiV4Ui", "") + +BUILTIN(__builtin_altivec_vsum4sbs, "V4SiV16ScV4Si", "") +BUILTIN(__builtin_altivec_vsum4ubs, "V4UiV16UcV4Ui", "") +BUILTIN(__builtin_altivec_vsum4shs, "V4SiV8SsV4Si", "") + +BUILTIN(__builtin_altivec_vsum2sws, "V4SiV4SiV4Si", "") + +BUILTIN(__builtin_altivec_vsumsws, "V4SiV4SiV4Si", "") + +BUILTIN(__builtin_altivec_vrfiz, "V4fV4f", "") + +BUILTIN(__builtin_altivec_vupkhsb, "V8sV16c", "") +BUILTIN(__builtin_altivec_vupkhpx, "V4UiV8s", "") +BUILTIN(__builtin_altivec_vupkhsh, "V4iV8s", "") + +BUILTIN(__builtin_altivec_vupklsb, "V8sV16c", "") +BUILTIN(__builtin_altivec_vupklpx, "V4UiV8s", "") +BUILTIN(__builtin_altivec_vupklsh, "V4iV8s", "") + BUILTIN(__builtin_altivec_vcmpbfp_p, "iiV4fV4f", "") BUILTIN(__builtin_altivec_vcmpgefp_p, "iiV4fV4f", "") diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt index c2a4e13..c595236 100644 --- a/include/clang/Basic/CMakeLists.txt +++ b/include/clang/Basic/CMakeLists.txt @@ -18,3 +18,15 @@ tablegen(DiagnosticGroups.inc -gen-clang-diag-groups) add_custom_target(ClangDiagnosticGroups DEPENDS DiagnosticGroups.inc) + +set(LLVM_TARGET_DEFINITIONS Attr.td) +tablegen(AttrList.inc + -gen-clang-attr-list + -I ${CMAKE_CURRENT_SOURCE_DIR}/../../) +add_custom_target(ClangAttrList + DEPENDS AttrList.inc) + +# ARM NEON +set(LLVM_TARGET_DEFINITIONS arm_neon.td) +tablegen(arm_neon.inc -gen-arm-neon-sema) +add_custom_target(ClangARMNeon DEPENDS arm_neon.inc) diff --git a/include/clang/Basic/DeclNodes.td b/include/clang/Basic/DeclNodes.td new file mode 100644 index 0000000..203fb45 --- /dev/null +++ b/include/clang/Basic/DeclNodes.td @@ -0,0 +1,70 @@ +class AttrSubject; + +class Decl<bit abstract = 0> : AttrSubject { + bit Abstract = abstract; +} + +class DDecl<Decl base, bit abstract = 0> : Decl<abstract> { + Decl Base = base; +} + +class DeclContext { } + +def TranslationUnit : Decl, DeclContext; +def Named : Decl<1>; + def Namespace : DDecl<Named>, DeclContext; + def UsingDirective : DDecl<Named>; + def NamespaceAlias : DDecl<Named>; + def Type : DDecl<Named, 1>; + def Typedef : DDecl<Type>; + def UnresolvedUsingTypename : DDecl<Type>; + def Tag : DDecl<Type, 1>, DeclContext; + def Enum : DDecl<Tag>; + def Record : DDecl<Tag>; + def CXXRecord : DDecl<Record>; + def ClassTemplateSpecialization : DDecl<CXXRecord>; + def ClassTemplatePartialSpecialization + : DDecl<ClassTemplateSpecialization>; + def TemplateTypeParm : DDecl<Type>; + def Value : DDecl<Named, 1>; + def EnumConstant : DDecl<Value>; + def UnresolvedUsingValue : DDecl<Value>; + def Declarator : DDecl<Value, 1>; + def Function : DDecl<Declarator>, DeclContext; + def CXXMethod : DDecl<Function>; + def CXXConstructor : DDecl<CXXMethod>; + def CXXDestructor : DDecl<CXXMethod>; + def CXXConversion : DDecl<CXXMethod>; + def Field : DDecl<Declarator>; + def ObjCIvar : DDecl<Field>; + def ObjCAtDefsField : DDecl<Field>; + def Var : DDecl<Declarator>; + def ImplicitParam : DDecl<Var>; + def ParmVar : DDecl<Var>; + def NonTypeTemplateParm : DDecl<Var>; + def Template : DDecl<Named, 1>; + def FunctionTemplate : DDecl<Template>; + def ClassTemplate : DDecl<Template>; + def TemplateTemplateParm : DDecl<Template>; + def Using : DDecl<Named>; + def UsingShadow : DDecl<Named>; + def ObjCMethod : DDecl<Named>, DeclContext; + def ObjCContainer : DDecl<Named, 1>, DeclContext; + def ObjCCategory : DDecl<ObjCContainer>; + def ObjCProtocol : DDecl<ObjCContainer>; + def ObjCInterface : DDecl<ObjCContainer>; + def ObjCImpl : DDecl<ObjCContainer, 1>; + def ObjCCategoryImpl : DDecl<ObjCImpl>; + def ObjCImplementation : DDecl<ObjCImpl>; + def ObjCProperty : DDecl<Named>; + def ObjCCompatibleAlias : DDecl<Named>; +def LinkageSpec : Decl, DeclContext; +def ObjCPropertyImpl : Decl; +def ObjCForwardProtocol : Decl; +def ObjCClass : Decl; +def FileScopeAsm : Decl; +def AccessSpec : Decl; +def Friend : Decl; +def FriendTemplate : Decl; +def StaticAssert : Decl; +def Block : Decl, DeclContext; diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 62f06ed..1fe0d81 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -24,7 +24,6 @@ namespace llvm { template <typename T> class SmallVectorImpl; - class raw_ostream; } namespace clang { @@ -36,8 +35,6 @@ namespace clang { class LangOptions; class PartialDiagnostic; class Preprocessor; - class SourceManager; - class SourceRange; // Import the diagnostic enums themselves. namespace diag { @@ -98,8 +95,8 @@ namespace clang { /// compilation. class FixItHint { public: - /// \brief Tokens that should be removed to correct the error. - SourceRange RemoveRange; + /// \brief Code that should be removed to correct the error. + CharSourceRange RemoveRange; /// \brief The location at which we should insert code to correct /// the error. @@ -129,15 +126,18 @@ public: /// \brief Create a code modification hint that removes the given /// source range. - static FixItHint CreateRemoval(SourceRange RemoveRange) { + static FixItHint CreateRemoval(CharSourceRange RemoveRange) { FixItHint Hint; Hint.RemoveRange = RemoveRange; return Hint; } - + static FixItHint CreateRemoval(SourceRange RemoveRange) { + return CreateRemoval(CharSourceRange::getTokenRange(RemoveRange)); + } + /// \brief Create a code modification hint that replaces the given /// source range with the given code string. - static FixItHint CreateReplacement(SourceRange RemoveRange, + static FixItHint CreateReplacement(CharSourceRange RemoveRange, llvm::StringRef Code) { FixItHint Hint; Hint.RemoveRange = RemoveRange; @@ -145,6 +145,11 @@ public: Hint.CodeToInsert = Code; return Hint; } + + static FixItHint CreateReplacement(SourceRange RemoveRange, + llvm::StringRef Code) { + return CreateReplacement(CharSourceRange::getTokenRange(RemoveRange), Code); + } }; /// Diagnostic - This concrete class is used by the front-end to report @@ -176,7 +181,14 @@ public: ak_nestednamespec, // NestedNameSpecifier * ak_declcontext // DeclContext * }; - + + /// Specifies which overload candidates to display when overload resolution + /// fails. + enum OverloadsShown { + Ovl_All, ///< Show all overloads. + Ovl_Best ///< Show just the "best" overload candidates. + }; + /// ArgumentValue - This typedef represents on argument value, which is a /// union discriminated by ArgumentKind, with a value. typedef std::pair<ArgumentKind, intptr_t> ArgumentValue; @@ -188,6 +200,7 @@ private: bool ErrorsAsFatal; // Treat errors like fatal errors. bool SuppressSystemWarnings; // Suppress warnings in system headers. bool SuppressAllDiagnostics; // Suppress all diagnostics. + OverloadsShown ShowOverloads; // Which overload candidates to show. unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit. unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack, // 0 -> no limit. @@ -318,6 +331,13 @@ public: } bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; } + /// \brief Specify which overload candidates to show when overload resolution + /// fails. By default, we show all candidates. + void setShowOverloads(OverloadsShown Val) { + ShowOverloads = Val; + } + OverloadsShown getShowOverloads() const { return ShowOverloads; } + /// \brief Pretend that the last diagnostic issued was ignored. This can /// be used by clients who suppress diagnostics themselves. void setLastDiagnosticIgnored() { @@ -582,7 +602,7 @@ private: /// DiagRanges - The list of ranges added to this diagnostic. It currently /// only support 10 ranges, could easily be extended if needed. - SourceRange DiagRanges[10]; + CharSourceRange DiagRanges[10]; enum { MaxFixItHints = 3 }; @@ -681,7 +701,7 @@ public: } } - void AddSourceRange(const SourceRange &R) const { + void AddSourceRange(const CharSourceRange &R) const { assert(NumRanges < sizeof(DiagObj->DiagRanges)/sizeof(DiagObj->DiagRanges[0]) && "Too many arguments to diagnostic!"); @@ -752,11 +772,17 @@ operator<<(const DiagnosticBuilder &DB, T *DC) { inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const SourceRange &R) { - DB.AddSourceRange(R); + DB.AddSourceRange(CharSourceRange::getTokenRange(R)); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, + const CharSourceRange &R) { + DB.AddSourceRange(R); + return DB; +} + +inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const FixItHint &Hint) { DB.AddFixItHint(Hint); return DB; @@ -849,7 +875,7 @@ public: return DiagObj->NumDiagRanges; } - SourceRange getRange(unsigned Idx) const { + const CharSourceRange &getRange(unsigned Idx) const { assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!"); return DiagObj->DiagRanges[Idx]; } @@ -886,7 +912,7 @@ class StoredDiagnostic { Diagnostic::Level Level; FullSourceLoc Loc; std::string Message; - std::vector<SourceRange> Ranges; + std::vector<CharSourceRange> Ranges; std::vector<FixItHint> FixIts; public: @@ -902,7 +928,7 @@ public: const FullSourceLoc &getLocation() const { return Loc; } llvm::StringRef getMessage() const { return Message; } - typedef std::vector<SourceRange>::const_iterator range_iterator; + typedef std::vector<CharSourceRange>::const_iterator range_iterator; range_iterator range_begin() const { return Ranges.begin(); } range_iterator range_end() const { return Ranges.end(); } unsigned range_size() const { return Ranges.size(); } diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 88e7dc1..4b0bf57 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -66,6 +66,7 @@ def err_target_unknown_triple : Error< "unknown target triple '%0', please use -triple or -arch">; def err_target_unknown_cpu : Error<"unknown target CPU '%0'">; def err_target_unknown_abi : Error<"unknown target ABI '%0'">; +def err_target_unknown_cxxabi : Error<"unknown C++ ABI '%0'">; def err_target_invalid_feature : Error<"invalid target feature '%0'">; // Source manager diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index c7cad73..989ec38 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -18,7 +18,10 @@ def err_fe_invalid_ast_action : Error<"invalid action for AST input">, DefaultFatal; // Error generated by the backend. def err_fe_inline_asm : Error<"%0">, CatInlineAsm; -def note_fe_inline_asm_here : Note<"generated from here">; +def note_fe_inline_asm_here : Note<"instantated into assembly here">; + + + def err_fe_invalid_code_complete_file : Error< "cannot locate code-completion file %0">, DefaultFatal; def err_fe_stdout_binary : Error<"unable to change standard output to binary">, @@ -186,9 +189,6 @@ def warn_pch_math_errno : Error< "math functions %select{do not respect|respect}0 'errno' in PCH " "file but they are currently set to %select{not respect|respect}1 " "'errno'">; -def warn_pch_overflow_checking : Error< - "signed integer overflow checking was %select{disabled|enabled}0 in PCH " - "file but is currently %select{disabled|enabled}1">; def warn_pch_optimize : Error< "the macro '__OPTIMIZE__' was %select{not defined|defined}0 in " "the PCH file but is currently %select{undefined|defined}1">; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index b79bf8e..930fe42 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -17,11 +17,14 @@ def Implicit : DiagGroup<"implicit", [ ]>; // Empty DiagGroups are recognized by clang but ignored. +def : DiagGroup<"abi">; def : DiagGroup<"address">; def AddressOfTemporary : DiagGroup<"address-of-temporary">; def : DiagGroup<"aggregate-return">; +def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">; def : DiagGroup<"attributes">; def : DiagGroup<"bad-function-cast">; +def BoolConversions : DiagGroup<"bool-conversions">; def : DiagGroup<"c++-compat">; def : DiagGroup<"cast-align">; def : DiagGroup<"cast-qual">; @@ -51,6 +54,7 @@ def : DiagGroup<"inline">; def : DiagGroup<"int-to-pointer-cast">; def : DiagGroup<"invalid-pch">; def LiteralRange : DiagGroup<"literal-range">; +def : DiagGroup<"main">; def MissingBraces : DiagGroup<"missing-braces">; def : DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; @@ -62,6 +66,7 @@ def : DiagGroup<"newline-eof">; def LongLong : DiagGroup<"long-long">; def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; +def InitializerOverrides : DiagGroup<"initializer-overrides">; def NonNull : DiagGroup<"nonnull">; def : DiagGroup<"nonportable-cfstrings">; def : DiagGroup<"non-virtual-dtor">; @@ -70,13 +75,17 @@ def : DiagGroup<"overflow">; def : DiagGroup<"overloaded-virtual">; def : DiagGroup<"packed">; def PointerArith : DiagGroup<"pointer-arith">; +def PoundWarning : DiagGroup<"#warnings">, + DiagCategory<"#warning Directive">; def : DiagGroup<"pointer-to-int-cast">; def : DiagGroup<"redundant-decls">; def ReturnType : DiagGroup<"return-type">; +def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy">; def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">; def : DiagGroup<"sequence-point">; def Shadow : DiagGroup<"shadow">; def : DiagGroup<"shorten-64-to-32">; +def : DiagGroup<"sign-promo">; def SignCompare : DiagGroup<"sign-compare">; def : DiagGroup<"synth">; @@ -108,6 +117,7 @@ def Trigraphs : DiagGroup<"trigraphs">; def : DiagGroup<"type-limits">; def Uninitialized : DiagGroup<"uninitialized">; def UnknownPragmas : DiagGroup<"unknown-pragmas">; +def UnknownAttributes : DiagGroup<"unknown-attributes">; def UnusedArgument : DiagGroup<"unused-argument">; def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; def UnusedFunction : DiagGroup<"unused-function">; @@ -137,7 +147,7 @@ def Parentheses : DiagGroup<"parentheses", [DiagGroup<"idiomatic-parentheses">]> // -Wconversion has its own warnings, but we split this one out for // legacy reasons. def Conversion : DiagGroup<"conversion", - [DiagGroup<"shorten-64-to-32">]>, + [DiagGroup<"shorten-64-to-32">, BoolConversions]>, DiagCategory<"Value Conversion Issue">; def Unused : DiagGroup<"unused", @@ -157,6 +167,7 @@ def Format2 : DiagGroup<"format=2", def Extra : DiagGroup<"extra", [ MissingFieldInitializers, + InitializerOverrides, SemiBeforeMethodBody, SignCompare, UnusedParameter diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 848e85c..21c93e7 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -106,7 +106,7 @@ def err_invalid_pth_file : Error< //===----------------------------------------------------------------------===// // Preprocessor Diagnostics //===----------------------------------------------------------------------===// -def pp_hash_warning : Warning<"#warning%0">, InGroup<DiagGroup<"#warnings">>; +def pp_hash_warning : Warning<"#warning%0">, InGroup<PoundWarning>; def pp_include_next_in_primary : Warning< "#include_next in primary source file">; def pp_include_macros_out_of_predefines : Error< @@ -225,6 +225,9 @@ def err__Pragma_malformed : Error< "_Pragma takes a parenthesized string literal">; def err_pragma_comment_malformed : Error< "pragma comment requires parenthesized identifier and optional string">; +def err_pragma_message_malformed : Error< + "pragma message requires parenthesized string">; +def warn_pragma_message : Warning<"%0">; def warn_pragma_ignored : Warning<"unknown pragma ignored">, InGroup<UnknownPragmas>, DefaultIgnore; def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 934bd0d..ca761f9 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -24,7 +24,9 @@ def ext_empty_source_file : Extension<"ISO C forbids an empty source file">; def ext_top_level_semi : Extension< "extra ';' outside of a function">; def ext_extra_struct_semi : Extension< - "extra ';' inside a struct or union">; + "extra ';' inside a %0">; +def ext_extra_ivar_semi : Extension< + "extra ';' inside instance variable list">; def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">; def ext_plain_complex : ExtWarn< @@ -35,6 +37,7 @@ def ext_thread_before : Extension<"'__thread' before 'static'">; def ext_empty_struct_union_enum : Extension<"use of empty %0 extension">; +def error_empty_enum : Error<"use of empty enum">; def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">; def err_invalid_short_spec : Error<"'short %0' is invalid">; def err_invalid_long_spec : Error<"'long %0' is invalid">; @@ -103,7 +106,7 @@ def err_expected_fn_body : Error< "expected function body after function declarator">; def err_expected_method_body : Error<"expected method body">; def err_invalid_token_after_toplevel_declarator : Error< - "invalid token after top level declarator">; + "expected ';' after top level declarator">; def err_expected_statement : Error<"expected statement">; def err_expected_lparen_after : Error<"expected '(' after '%0'">; def err_expected_lparen_after_id : Error<"expected '(' after %0">; @@ -168,11 +171,15 @@ def err_typename_invalid_functionspec : Error< def err_invalid_decl_spec_combination : Error< "cannot combine with previous '%0' declaration specifier">; def err_invalid_vector_decl_spec_combination : Error< - "cannot combine with previous '%0' declaration specifier. '__vector' must be first">; + "cannot combine with previous '%0' declaration specifier. " + "'__vector' must be first">; def err_invalid_pixel_decl_spec_combination : Error< - "'__pixel' must be preceded by '__vector'. '%0' declaration specifier not allowed here">; -def err_invalid_vector_double_decl_spec_combination : Error< - "cannot use 'double' with '__vector'">; + "'__pixel' must be preceded by '__vector'. " + "'%0' declaration specifier not allowed here">; +def err_invalid_vector_decl_spec : Error< + "cannot use '%0' with '__vector'">; +def err_invalid_vector_bool_decl_spec : Error< + "cannot use '%0' with '__vector bool'">; def warn_vector_long_decl_spec_combination : Warning< "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>; def err_friend_invalid_in_context : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 0ba31ae..8fac1ed 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -21,12 +21,6 @@ def ext_expr_not_ice : Extension< "expression is not integer constant expression " "(but is allowed as an extension)">; -def ext_null_pointer_expr_not_ice : Extension< - "null pointer expression is not an integer constant expression " - "(but is allowed as an extension)">; - - - // Semantic analysis of constant literals. def ext_predef_outside_function : Warning< "predefined identifier is only valid inside function">; @@ -80,9 +74,10 @@ def err_designator_for_scalar_init : Error< "designator in initializer for scalar type %0">; def warn_subobject_initializer_overrides : Warning< "subobject initialization overrides initialization of other fields " - "within its enclosing subobject">; + "within its enclosing subobject">, InGroup<InitializerOverrides>; def warn_initializer_overrides : Warning< - "initializer overrides prior initialization of this subobject">; + "initializer overrides prior initialization of this subobject">, + InGroup<InitializerOverrides>; def note_previous_initializer : Note< "previous initialization %select{|with side effects }0is here" "%select{| (side effects may not occur at run time)}0">; @@ -125,6 +120,8 @@ def warn_use_out_of_scope_declaration : Warning< "use of out-of-scope declaration of %0">; def err_inline_non_function : Error< "'inline' can only appear on functions">; +def warn_qual_return_type : Warning< + "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">; def warn_decl_shadow : Warning<"declaration shadows a %select{" @@ -230,6 +227,7 @@ def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 " /// parser diagnostics def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">; +def err_typedef_not_identifier : Error<"typedef name must be an identifier">; def err_statically_allocated_object : Error< "interface type cannot be statically allocated">; def err_object_cannot_be_passed_returned_by_value : Error< @@ -458,6 +456,9 @@ def warn_weak_vtable : Warning< "emitted in every translation unit">, InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore; +def ext_using_undefined_std : ExtWarn< + "using directive refers to implicitly-defined namespace 'std'">; + // C++ exception specifications def err_exception_spec_in_typedef : Error< "exception specifications are not allowed in typedefs">; @@ -486,6 +487,10 @@ def err_access : Error< "%1 is a %select{private|protected}0 member of %3">, NoSFINAE; def err_access_ctor : Error< "calling a %select{private|protected}0 constructor of class %2">, NoSFINAE; +def ext_rvalue_to_reference_access_ctor : ExtWarn< + "C++98 requires an accessible copy constructor for class %2 when binding " + "a reference to a temporary; was %select{private|protected}0">, + NoSFINAE, InGroup<BindToTemporaryCopy>; def err_access_base : Error< "%select{base class|inherited virtual base class}0 %1 has %select{private|" "protected}3 %select{constructor|copy constructor|copy assignment operator|" @@ -507,6 +512,9 @@ def err_access_dtor_vbase : def err_access_dtor_temp : Error<"temporary of type %0 has %select{private|protected}1 destructor">, NoSFINAE; +def err_access_dtor_exception : + Error<"exception object of type %0 has %select{private|protected}1 " + "destructor">, NoSFINAE; def err_access_dtor_field : Error<"field of type %1 has %select{private|protected}2 destructor">, NoSFINAE; @@ -549,6 +557,9 @@ def err_dependent_nested_name_spec : Error< "parameter">; def err_nested_name_member_ref_lookup_ambiguous : Error< "lookup of %0 in member access expression is ambiguous">; +def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn< + "lookup of %0 in member access expression is ambiguous; using member of %1">, + InGroup<AmbigMemberTemplate>; def note_ambig_member_ref_object_type : Note< "lookup in the object type %0 refers here">; def note_ambig_member_ref_scope : Note< @@ -744,6 +755,13 @@ def err_temp_copy_no_viable : Error< "returning object|throwing object|copying member subobject|copying array " "element|allocating object|copying temporary|initializing base subobject|" "initializing vector element}0 of type %1">; +def ext_rvalue_to_reference_temp_copy_no_viable : ExtWarn< + "no viable constructor %select{copying variable|copying parameter|" + "returning object|throwing object|copying member subobject|copying array " + "element|allocating object|copying temporary|initializing base subobject|" + "initializing vector element}0 of type %1; C++98 requires a copy " + "constructor when binding a reference to a temporary">, + InGroup<BindToTemporaryCopy>; def err_temp_copy_ambiguous : Error< "ambiguous constructor call when %select{copying variable|copying " "parameter|returning object|throwing object|copying member subobject|copying " @@ -797,9 +815,15 @@ def err_attribute_wrong_number_arguments : Error< "attribute requires %0 argument(s)">; def err_attribute_missing_parameter_name : Error< "attribute requires unquoted parameter">; -def err_attribute_invalid_vector_type : Error<"invalid vector type %0">; +def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">; def err_attribute_argument_not_int : Error< "'%0' attribute requires integer constant">; +def err_attribute_argument_outof_range : Error< + "init_priority attribute requires integer constant between " + "101 and 65535 inclusive">; +def err_init_priority_object_attr : Error< + "can only use ‘init_priority’ attribute on file-scope definitions " + "of objects of class type">; def err_attribute_argument_n_not_int : Error< "'%0' attribute requires parameter %1 to be an integer constant">; def err_attribute_argument_n_not_string : Error< @@ -838,7 +862,8 @@ def err_attribute_address_space_too_high : Error< def err_attribute_address_multiple_qualifiers : Error< "multiple address spaces specified for type">; def err_implicit_pointer_address_space_cast : Error< - "illegal implicit cast between two pointers with different address spaces">; + "illegal implicit conversion between two pointers with different address " + "spaces">; def err_as_qualified_auto_decl : Error< "automatic variable qualified with an address space">; def err_arg_with_address_space : Error< @@ -854,6 +879,8 @@ def err_attribute_aligned_not_power_of_two : Error< 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_attribute_precede_definition : Warning< "attribute declaration must precede definition">; def warn_attribute_void_function_method : Warning< @@ -899,30 +926,34 @@ def err_cconv_knr : Error< "function with no prototype cannot use %0 calling convention">; def err_cconv_varargs : Error< "variadic function cannot use %0 calling convention">; +def err_regparm_mismatch : Error<"function declared with with regparm(%0) " + "attribute was previously declared %plural{0:without the regparm|1:" + "with the regparm(1)|2:with the regparm(2)|3:with the regparm(3)|:with the" + "regparm}1 attribute">; def warn_impcast_vector_scalar : Warning< - "implicit cast turns vector to scalar: %0 to %1">, + "implicit conversion turns vector to scalar: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_complex_scalar : Warning< - "implicit cast discards imaginary component: %0 to %1">, + "implicit conversion discards imaginary component: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_float_precision : Warning< - "implicit cast loses floating-point precision: %0 to %1">, + "implicit conversion loses floating-point precision: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_float_integer : Warning< - "implicit cast turns floating-point number into integer: %0 to %1">, + "implicit conversion turns floating-point number into integer: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_integer_sign : Warning< - "implicit cast changes signedness: %0 to %1">, + "implicit conversion changes signedness: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_integer_sign_conditional : Warning< "operand of ? changes signedness: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_integer_precision : Warning< - "implicit cast loses integer precision: %0 to %1">, + "implicit conversion loses integer precision: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_integer_64_32 : Warning< - "implicit cast loses integer precision: %0 to %1">, + "implicit conversion loses integer precision: %0 to %1">, InGroup<DiagGroup<"shorten-64-to-32">>, DefaultIgnore; def warn_attribute_ignored_for_field_of_type : Warning< @@ -937,8 +968,8 @@ def warn_transparent_union_attribute_not_definition : Warning< "transparent_union attribute can only be applied to a union definition; " "attribute ignored">; def warn_transparent_union_attribute_floating : Warning< - "first field of a transparent union cannot have floating point or vector " - "type; transparent_union attribute ignored">; + "first field of a transparent union cannot have %select{floating point|" + "vector}0 type %1; transparent_union attribute ignored">; def warn_transparent_union_attribute_zero_fields : Warning< "transparent union definition must contain at least one field; " "transparent_union attribute ignored">; @@ -1077,6 +1108,9 @@ def err_ovl_ambiguous_member_call : Error< "call to member function %0 is ambiguous">; def err_ovl_deleted_member_call : Error< "call to %select{unavailable|deleted}0 member function %1">; +def note_ovl_too_many_candidates : Note< + "remaining %0 candidate%s0 omitted; " + "pass -fshow-overloads=all to show them">; def note_ovl_candidate : Note<"candidate " "%select{function|function|constructor|" "function |function |constructor |" @@ -1084,6 +1118,10 @@ def note_ovl_candidate : Note<"candidate " "is the implicit copy constructor|" "is the implicit copy assignment operator}0%1">; +def warn_init_pointer_from_false : Warning< + "initialization of pointer of type %0 from literal 'false'">, + InGroup<BoolConversions>; + def note_ovl_candidate_bad_deduction : Note< "candidate template ignored: failed template argument deduction">; def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: " @@ -1168,6 +1206,17 @@ def note_ovl_candidate_bad_cvr : Note<"candidate " "%select{const|volatile|const and volatile|restrict|const and restrict|" "volatile and restrict|const, volatile, and restrict}3 qualifier" "%select{||s||s|s|s}3">; +def note_ovl_candidate_bad_base_to_derived_conv : Note<"candidate " + "%select{function|function|constructor|" + "function |function |constructor |" + "constructor (the implicit default constructor)|" + "constructor (the implicit copy constructor)|" + "function (the implicit copy assignment operator)}0%1" + " not viable: cannot %select{convert from|convert from|bind}2 " + "%select{base class pointer|superclass|base class object of type}2 %3 to " + "%select{derived class pointer|subclass|derived class reference}2 %4 for " + "%ordinal5 argument">; + def note_ambiguous_type_conversion: Note< "because of ambiguity in conversion of %0 to %1">; def note_ovl_builtin_binary_candidate : Note< @@ -1234,6 +1283,7 @@ def err_template_param_different_kind : Error< "%select{|template parameter }0redeclaration">; def note_template_param_different_kind : Note< "template parameter has a different kind in template argument">; + def err_template_nontype_parm_different_type : Error< "template non-type parameter has a different type %0 in template " "%select{|template parameter }1redeclaration">; @@ -1528,6 +1578,8 @@ def err_explicit_instantiation_nontemplate_type : Error< "explicit instantiation of non-templated type %0">; def note_nontemplate_decl_here : Note< "non-templated declaration is here">; +def err_explicit_instantiation_in_class : Error< + "explicit instantiation of %0 in class scope">; def err_explicit_instantiation_out_of_scope : Error< "explicit instantiation of %0 not in a namespace enclosing %1">; def err_explicit_instantiation_must_be_global : Error< @@ -1560,10 +1612,9 @@ def note_explicit_instantiation_candidate : Note< "explicit instantiation candidate function template here %0">; def err_explicit_instantiation_inline : Error< "explicit instantiation cannot be 'inline'">; -def err_explicit_instantiation_without_qualified_id : Error< - "qualifier in explicit instantiation of %q0 requires a template-id">; -def err_explicit_instantiation_without_qualified_id_quals : Error< - "qualifier in explicit instantiation of '%0%1' requires a template-id">; +def ext_explicit_instantiation_without_qualified_id : ExtWarn< + "qualifier in explicit instantiation of %q0 requires a template-id " + "(a typedef is not permitted)">; def err_explicit_instantiation_unqualified_wrong_namespace : Error< "explicit instantiation of %q0 must occur in %1">; def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning< @@ -1588,6 +1639,8 @@ def note_typename_refers_here : Note< "referenced member %0 is declared here">; def err_typename_missing : Error< "missing 'typename' prior to dependent type name '%0%1'">; +def ext_typename_outside_of_template : ExtWarn< + "'typename' occurs outside of a template">; def err_template_kw_refers_to_non_template : Error< "%0 following the 'template' keyword does not refer to a template">; @@ -1599,6 +1652,8 @@ def note_referenced_class_template : Error< "class template declared here">; def err_template_kw_missing : Error< "missing 'template' keyword prior to dependent template name '%0%1'">; +def ext_template_outside_of_template : ExtWarn< + "'template' keyword outside of a template">; // C++0x Variadic Templates def err_template_param_pack_default_arg : Error< @@ -1606,6 +1661,18 @@ def err_template_param_pack_default_arg : Error< def err_template_param_pack_must_be_last_template_parameter : Error< "template parameter pack must be the last template parameter">; +def err_template_parameter_pack_non_pack : Error< + "template %select{type|non-type|template}0 parameter%select{| pack}1 " + "conflicts with previous template %select{type|non-type|template}0 " + "parameter%select{ pack|}1">; +def note_template_parameter_pack_non_pack : Note< + "template %select{type|non-type|template}0 parameter%select{| pack}1 " + "does not match template %select{type|non-type|template}0 " + "parameter%select{ pack|}1 in template argument">; +def note_template_parameter_pack_here : Note< + "previous template %select{type|non-type|template}0 " + "parameter%select{| pack}1 declared here">; + def err_unexpected_typedef : Error< "unexpected type name %0: expected expression">; def err_unexpected_namespace : Error< @@ -1674,6 +1741,9 @@ def ext_forward_ref_enum : Extension< "ISO C forbids forward references to 'enum' types">; def err_forward_ref_enum : Error< "ISO C++ forbids forward references to 'enum' types">; +def ext_forward_ref_enum_def : Extension< + "redeclaration of already-defined enum %0 is a GNU extension">, InGroup<GNU>; + def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">; def err_duplicate_member : Error<"duplicate member %0">; def err_misplaced_ivar : Error< @@ -1848,6 +1918,8 @@ def err_illegal_decl_array_of_functions : Error< "'%0' declared as array of functions of type %1">; def err_illegal_decl_array_incomplete_type : Error< "array has incomplete element type %0">; +def err_illegal_message_expr_incomplete_type : Error< + "objective-c message has incomplete result type %0">; def err_illegal_decl_array_of_references : Error< "'%0' declared as array of references of type %1">; def err_array_star_outside_prototype : Error< @@ -2028,6 +2100,11 @@ def err_typecheck_unary_expr : Error< "invalid argument type %0 to unary expression">; def err_typecheck_indirection_requires_pointer : Error< "indirection requires pointer operand (%0 invalid)">; +def warn_indirection_through_null : Warning< + "indirection of non-volatile null pointer will be deleted, not trap">; +def note_indirection_through_null : Note< + "consider using __builtin_trap() or qualifying pointer with 'volatile'">; + def err_indirection_requires_nonfragile_object : Error< "indirection cannot be to an interface in non-fragile ABI (%0 invalid)">; def err_direct_interface_unsupported : Error< @@ -2046,8 +2123,12 @@ def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn< "ordered comparison of function pointers (%0 and %1)">; def ext_typecheck_comparison_of_fptr_to_void : Extension< "equality comparison between function pointer and void pointer (%0 and %1)">; +def err_typecheck_comparison_of_fptr_to_void : Error< + "equality comparison between function pointer and void pointer (%0 and %1)">; def ext_typecheck_comparison_of_pointer_integer : ExtWarn< "comparison between pointer and integer (%0 and %1)">; +def err_typecheck_comparison_of_pointer_integer : Error< + "comparison between pointer and integer (%0 and %1)">; def ext_typecheck_comparison_of_distinct_pointers : ExtWarn< "comparison of distinct pointer types (%0 and %1)">; def ext_typecheck_cond_incompatible_operands : ExtWarn< @@ -2081,9 +2162,11 @@ def err_invalid_member_use_in_static_method : Error< "invalid use of member %0 in static member function">; def err_invalid_qualified_function_type : Error< "type qualifier is not allowed on this function">; +def err_invalid_qualified_function_pointer : Error< + "type qualifier is not allowed on this function %select{pointer|reference}0">; def err_invalid_qualified_typedef_function_type_use : Error< - "a qualified function type cannot be used to declare a nonmember function " - "or a static member function">; + "a qualified function type cannot be used to declare a " + "%select{static member|nonmember}0 function">; def err_invalid_non_static_member_use : Error< "invalid use of nonstatic data member %0">; @@ -2260,13 +2343,26 @@ def err_new_array_nonconst : Error< "only the first dimension of an allocated array may have dynamic size">; def err_new_array_init_args : Error< "array 'new' cannot have initialization arguments">; -def err_new_paren_array_nonconst : Error< +def ext_new_paren_array_nonconst : ExtWarn< "when type is in parentheses, array cannot have dynamic size">; def err_placement_new_non_placement_delete : Error< "'new' expression with placement arguments refers to non-placement " "'operator delete'">; def err_array_size_not_integral : Error< "array size expression must have integral or enumerated type, not %0">; +def err_array_size_incomplete_type : Error< + "array size expression has incomplete class type %0">; +def err_array_size_explicit_conversion : Error< + "array size expression of type %0 requires explicit conversion to type %1">; +def note_array_size_conversion : Note< + "conversion to %select{integral|enumeration}0 type %1 declared here">; +def err_array_size_ambiguous_conversion : Error< + "ambiguous conversion of array size expression of type %0 to an integral or " + "enumeration type">; +def ext_array_size_conversion : Extension< + "implicit conversion from array size expression of type %0 to " + "%select{integral|enumeration}1 type %2 is a C++0x extension">; + def err_default_init_const : Error< "default initialization of an object of const type %0" "%select{| requires a user-provided default constructor}1">; @@ -2866,11 +2962,17 @@ def warn_printf_asterisk_missing_arg : Warning< def warn_printf_asterisk_wrong_type : Warning< "field %select{width|precision}0 should have type %1, but argument has type %2">, InGroup<Format>; -def warn_printf_nonsensical_precision: Warning< - "precision used in '%0' conversion specifier (where it has no meaning)">, +def warn_printf_nonsensical_optional_amount: Warning< + "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">, InGroup<Format>; def warn_printf_nonsensical_flag: Warning< - "flag '%0' results in undefined behavior in '%1' conversion specifier">, + "flag '%0' results in undefined behavior with '%1' conversion specifier">, + InGroup<Format>; +def warn_printf_nonsensical_length: Warning< + "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">, + InGroup<Format>; +def warn_printf_ignored_flag: Warning< + "flag '%0' is ignored when flag '%1' is present">, InGroup<Format>; // CHECK: returning address/reference of stack memory @@ -2886,8 +2988,10 @@ def err_ret_local_block : Error< // For non-floating point, expressions of the form x == x or x != x // should result in a warning, since these always evaluate to a constant. -def warn_selfcomparison : Warning< - "self-comparison always results in a constant value">; +// Array comparisons have similar warnings +def warn_comparison_always : Warning< + "%select{self-|array }0comparison always evaluates to %select{false|true|a constant}1">; + def warn_stringcompare : Warning< "result of comparison against %select{a string literal|@encode}0 is " "unspecified (use strncmp instead)">; @@ -2956,13 +3060,13 @@ def err_first_argument_to_va_arg_not_of_type_va_list : Error< "first argument to 'va_arg' is of type %0 and not 'va_list'">; def warn_return_missing_expr : Warning< - "non-void %select{function|method}1 %0 should return a value">, + "non-void %select{function|method}1 %0 should return a value">, DefaultError, InGroup<ReturnType>; def ext_return_missing_expr : ExtWarn< - "non-void %select{function|method}1 %0 should return a value">, + "non-void %select{function|method}1 %0 should return a value">, DefaultError, InGroup<ReturnType>; def ext_return_has_expr : ExtWarn< - "void %select{function|method}1 %0 should not return a value">, + "void %select{function|method}1 %0 should not return a value">, DefaultError, InGroup<ReturnType>; def ext_return_has_void_expr : Extension< "void %select{function|method}1 %0 should not return void expression">; @@ -2993,6 +3097,8 @@ def err_vector_incorrect_num_initializers : Error< "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">; def err_altivec_empty_initializer : Error<"expected initializer">; +def err_invalid_neon_type_code : Error< + "incompatible constant for this __builtin_neon function">; def err_argument_invalid_range : Error< "argument should be a value from %0 to %1">; @@ -3003,7 +3109,9 @@ def err_constant_integer_arg_type : Error< "argument to %0 must be a constant integer">; def ext_mixed_decls_code : Extension< - "ISO C90 forbids mixing declarations and code">; + "ISO C90 forbids mixing declarations and code">, + InGroup<DiagGroup<"declaration-after-statement">>; + def err_non_variable_decl_in_for : Error< "declaration of non-local variable in 'for' loop">; def err_toomany_element_decls : Error< @@ -3094,6 +3202,11 @@ def err_undeclared_protocol_suggest : Error< "cannot find protocol declaration for %0; did you mean %1?">; def note_base_class_specified_here : Note< "base class %0 specified here">; +def err_using_directive_suggest : Error< + "no namespace named %0; did you mean %1?">; +def err_using_directive_member_suggest : Error< + "no namespace named %0 in %1; did you mean %2?">; +def note_namespace_defined_here : Note<"namespace %0 defined here">; } // end of sema category } // end of sema component. diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 582d59c..6b8bcdc 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -89,7 +89,8 @@ public: // The 'this' pointer really points to a // std::pair<IdentifierInfo, const char*>, where internal pointer // points to the external string data. - return ((std::pair<IdentifierInfo, const char*>*) this)->second; + typedef std::pair<IdentifierInfo, const char*> actualtype; + return ((const actualtype*) this)->second; } /// getLength - Efficiently return the length of this identifier info. @@ -101,7 +102,8 @@ public: // The 'this' pointer really points to a // std::pair<IdentifierInfo, const char*>, where internal pointer // points to the external string data. - const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second-2; + typedef std::pair<IdentifierInfo, const char*> actualtype; + const char* p = ((const actualtype*) this)->second - 2; return (((unsigned) p[0]) | (((unsigned) p[1]) << 8)) - 1; } diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 1ed86f1..bbcceb7 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -66,9 +66,6 @@ public: unsigned MathErrno : 1; // Math functions must respect errno // (modulo the platform support). - unsigned OverflowChecking : 1; // Extension to call a handler function when - // signed integer arithmetic overflows. - unsigned HeinousExtensions : 1; // Extensions that we really don't like and // may be ripped out at any time. @@ -102,20 +99,21 @@ public: unsigned DumpRecordLayouts : 1; /// Dump the layout of IRgen'd records. unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables. unsigned NoConstantCFStrings : 1; // Do not do CF strings + unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have + // hidden visibility by default. + unsigned SpellChecking : 1; // Whether to perform spell-checking for error + // recovery. // FIXME: This is just a temporary option, for testing purposes. unsigned NoBitFieldTypeAlign : 1; private: - unsigned GC : 2; // Objective-C Garbage Collection modes. We - // declare this enum as unsigned because MSVC - // insists on making enums signed. Set/Query - // this value using accessors. + // We declare multibit enums as unsigned because MSVC insists on making enums + // signed. Set/Query these values using accessors. + unsigned GC : 2; // Objective-C Garbage Collection modes. unsigned SymbolVisibility : 3; // Symbol's visibility. - unsigned StackProtector : 2; // Whether stack protectors are on. We declare - // this enum as unsigned because MSVC insists - // on making enums signed. Set/Query this - // value using accessors. + unsigned StackProtector : 2; // Whether stack protectors are on. + unsigned SignedOverflowBehavior : 2; // How to handle signed integer overflow. public: unsigned InstantiationDepth; // Maximum template instantiation depth. @@ -129,13 +127,19 @@ public: Protected, Hidden }; + + enum SignedOverflowBehaviorTy { + SOB_Undefined, // Default C standard behavior. + SOB_Defined, // -fwrapv + SOB_Trapping // -ftrapv + }; LangOptions() { Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0; GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0; HexFloats = 0; GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0; - NoConstantCFStrings = 0; + NoConstantCFStrings = 0; InlineVisibilityHidden = 0; C99 = Microsoft = CPlusPlus = CPlusPlus0x = 0; CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0; @@ -146,20 +150,19 @@ public: AltiVec = OpenCL = StackProtector = 0; SymbolVisibility = (unsigned) Default; - + ThreadsafeStatics = 1; POSIXThreads = 0; Blocks = 0; EmitAllDecls = 0; MathErrno = 1; - + SignedOverflowBehavior = SOB_Undefined; + AssumeSaneOperatorNew = 1; - - // FIXME: The default should be 1. - AccessControl = 0; + AccessControl = 1; ElideConstructors = 1; - OverflowChecking = 0; + SignedOverflowBehavior = 0; ObjCGCBitmapPrint = 0; InstantiationDepth = 1024; @@ -178,6 +181,7 @@ public: CatchUndefined = 0; DumpRecordLayouts = 0; DumpVTableLayouts = 0; + SpellChecking = 1; NoBitFieldTypeAlign = 0; } @@ -195,6 +199,13 @@ public: return (VisibilityMode) SymbolVisibility; } void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; } + + SignedOverflowBehaviorTy getSignedOverflowBehavior() const { + return (SignedOverflowBehaviorTy)SignedOverflowBehavior; + } + void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) { + SignedOverflowBehavior = (unsigned)V; + } }; } // end namespace clang diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile index 48f7f9d..7db3e29 100644 --- a/include/clang/Basic/Makefile +++ b/include/clang/Basic/Makefile @@ -1,16 +1,33 @@ -LEVEL = ../../../../.. -BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \ +CLANG_LEVEL := ../../.. +BUILT_SOURCES = \ + DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \ DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \ DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \ DiagnosticParseKinds.inc DiagnosticSemaKinds.inc \ - DiagnosticGroups.inc + DiagnosticGroups.inc AttrList.inc arm_neon.inc \ + Version.inc TABLEGEN_INC_FILES_COMMON = 1 -include $(LEVEL)/Makefile.common +include $(CLANG_LEVEL)/Makefile INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td) +# Compute the Clang version from the LLVM version, unless specified explicitly. +ifndef CLANG_VERSION +CLANG_VERSION := $(subst svn,,$(LLVMVersion)) +endif + +CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION)) +CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS)) +CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS)) +CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS)) +ifeq ($(CLANG_VERSION_PATCHLEVEL),) +CLANG_HAS_VERSION_PATCHLEVEL := 0 +else +CLANG_HAS_VERSION_PATCHLEVEL := 1 +endif + $(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td Diagnostic%Kinds.td $(TBLGEN) $(ObjDir)/.dir $(Echo) "Building Clang $(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) diagnostic tables with tblgen" $(Verb) $(TableGen) -gen-clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) -o $(call SYSPATH, $@) $< @@ -19,4 +36,20 @@ $(ObjDir)/DiagnosticGroups.inc.tmp : Diagnostic.td DiagnosticGroups.td $(INPUT_T $(Echo) "Building Clang diagnostic groups with tblgen" $(Verb) $(TableGen) -gen-clang-diag-groups -o $(call SYSPATH, $@) $< +$(ObjDir)/AttrList.inc.tmp : Attr.td $(TBLGEN) $(ObjDir)/.dir + $(Echo) "Building Clang attribute list with tblgen" + $(Verb) $(TableGen) -gen-clang-attr-list -o $(call SYSPATH, $@) \ + -I $(PROJ_SRC_DIR)/../.. $< + +$(ObjDir)/arm_neon.inc.tmp : arm_neon.td $(TBLGEN) $(ObjDir)/.dir + $(Echo) "Building Clang arm_neon.inc with tblgen" + $(Verb) $(TableGen) -gen-arm-neon-sema -o $(call SYSPATH, $@) $< +$(ObjDir)/Version.inc.tmp : Version.inc.in Makefile $(LLVM_OBJ_ROOT)/Makefile.config $(ObjDir)/.dir + $(Echo) "Updating Clang version info." + $(Verb)sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \ + -e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \ + -e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \ + -e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \ + -e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \ + $< > $@ diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 89fae87..cd0da97 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -59,7 +59,7 @@ public: /// DiagRanges - The list of ranges added to this diagnostic. It currently /// only support 10 ranges, could easily be extended if needed. - SourceRange DiagRanges[10]; + CharSourceRange DiagRanges[10]; enum { MaxFixItHints = 3 }; @@ -142,7 +142,7 @@ private: DiagStorage = 0; } - void AddSourceRange(const SourceRange &R) const { + void AddSourceRange(const CharSourceRange &R) const { if (!DiagStorage) DiagStorage = getStorage(); @@ -264,10 +264,16 @@ public: friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const SourceRange &R) { - PD.AddSourceRange(R); + PD.AddSourceRange(CharSourceRange::getTokenRange(R)); return PD; } + friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, + const CharSourceRange &R) { + PD.AddSourceRange(R); + return PD; + } + friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const FixItHint &Hint) { PD.AddFixItHint(Hint); diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 0bbeffe..35f27fb 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -172,6 +172,56 @@ public: return B != X.B || E != X.E; } }; + +/// CharSourceRange - This class represents a character granular source range. +/// The underlying SourceRange can either specify the starting/ending character +/// of the range, or it can specify the start or the range and the start of the +/// last token of the range (a "token range"). In the token range case, the +/// size of the last token must be measured to determine the actual end of the +/// range. +class CharSourceRange { + SourceRange Range; + bool IsTokenRange; +public: + CharSourceRange() : IsTokenRange(false) {} + CharSourceRange(SourceRange R, bool ITR) : Range(R),IsTokenRange(ITR){} + + static CharSourceRange getTokenRange(SourceRange R) { + CharSourceRange Result; + Result.Range = R; + Result.IsTokenRange = true; + return Result; + } + + static CharSourceRange getCharRange(SourceRange R) { + CharSourceRange Result; + Result.Range = R; + Result.IsTokenRange = false; + return Result; + } + + static CharSourceRange getTokenRange(SourceLocation B, SourceLocation E) { + return getTokenRange(SourceRange(B, E)); + } + static CharSourceRange getCharRange(SourceLocation B, SourceLocation E) { + return getCharRange(SourceRange(B, E)); + } + + /// isTokenRange - Return true if the end of this range specifies the start of + /// the last token. Return false if the end of this range specifies the last + /// character in the range. + bool isTokenRange() const { return IsTokenRange; } + + SourceLocation getBegin() const { return Range.getBegin(); } + SourceLocation getEnd() const { return Range.getEnd(); } + const SourceRange &getAsRange() const { return Range; } + + void setBegin(SourceLocation b) { Range.setBegin(b); } + void setEnd(SourceLocation e) { Range.setEnd(e); } + + bool isValid() const { return Range.isValid(); } + bool isInvalid() const { return !isValid(); } +}; /// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful /// for argument passing to functions that expect both objects. diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td new file mode 100644 index 0000000..a2f6973 --- /dev/null +++ b/include/clang/Basic/StmtNodes.td @@ -0,0 +1,130 @@ +class AttrSubject; + +class Stmt<bit abstract = 0> : AttrSubject { + bit Abstract = abstract; +} + +class DStmt<Stmt base, bit abstract = 0> : Stmt<abstract> { + Stmt Base = base; +} + +// Statements +def NullStmt : Stmt; +def CompoundStmt : Stmt; +def LabelStmt : Stmt; +def IfStmt : Stmt; +def SwitchStmt : Stmt; +def WhileStmt : Stmt; +def DoStmt : Stmt; +def ForStmt : Stmt; +def GotoStmt : Stmt; +def IndirectGotoStmt : Stmt; +def ContinueStmt : Stmt; +def BreakStmt : Stmt; +def ReturnStmt : Stmt; +def DeclStmt : Stmt; +def SwitchCase : Stmt; +def CaseStmt : DStmt<SwitchCase>; +def DefaultStmt : DStmt<SwitchCase>; + +// GNU Extensions +def AsmStmt : Stmt; + +// Obj-C statements +def ObjCAtTryStmt : Stmt; +def ObjCAtCatchStmt : Stmt; +def ObjCAtFinallyStmt : Stmt; +def ObjCAtThrowStmt : Stmt; +def ObjCAtSynchronizedStmt : Stmt; +def ObjCForCollectionStmt : Stmt; + +// C++ statments +def CXXCatchStmt : Stmt; +def CXXTryStmt : Stmt; + +// Expressions +def Expr : Stmt<1>; +def PredefinedExpr : DStmt<Expr>; +def DeclRefExpr : DStmt<Expr>; +def IntegerLiteral : DStmt<Expr>; +def FloatingLiteral : DStmt<Expr>; +def ImaginaryLiteral : DStmt<Expr>; +def StringLiteral : DStmt<Expr>; +def CharacterLiteral : DStmt<Expr>; +def ParenExpr : DStmt<Expr>; +def UnaryOperator : DStmt<Expr>; +def OffsetOfExpr : DStmt<Expr>; +def SizeOfAlignOfExpr : DStmt<Expr>; +def ArraySubscriptExpr : DStmt<Expr>; +def CallExpr : DStmt<Expr>; +def MemberExpr : DStmt<Expr>; +def CastExpr : DStmt<Expr, 1>; +def BinaryOperator : DStmt<Expr>; +def CompoundAssignOperator : DStmt<BinaryOperator>; +def ConditionalOperator : DStmt<Expr>; +def ImplicitCastExpr : DStmt<CastExpr>; +def ExplicitCastExpr : DStmt<CastExpr, 1>; +def CStyleCastExpr : DStmt<ExplicitCastExpr>; +def CompoundLiteralExpr : DStmt<Expr>; +def ExtVectorElementExpr : DStmt<Expr>; +def InitListExpr : DStmt<Expr>; +def DesignatedInitExpr : DStmt<Expr>; +def ImplicitValueInitExpr : DStmt<Expr>; +def ParenListExpr : DStmt<Expr>; +def VAArgExpr : DStmt<Expr>; + +// GNU Extensions. +def AddrLabelExpr : DStmt<Expr>; +def StmtExpr : DStmt<Expr>; +def TypesCompatibleExpr : DStmt<Expr>; +def ChooseExpr : DStmt<Expr>; +def GNUNullExpr : DStmt<Expr>; + +// C++ Expressions. +def CXXOperatorCallExpr : DStmt<CallExpr>; +def CXXMemberCallExpr : DStmt<CallExpr>; +def CXXNamedCastExpr : DStmt<ExplicitCastExpr, 1>; +def CXXStaticCastExpr : DStmt<CXXNamedCastExpr>; +def CXXDynamicCastExpr : DStmt<CXXNamedCastExpr>; +def CXXReinterpretCastExpr : DStmt<CXXNamedCastExpr>; +def CXXConstCastExpr : DStmt<CXXNamedCastExpr>; +def CXXFunctionalCastExpr : DStmt<ExplicitCastExpr>; +def CXXTypeidExpr : DStmt<Expr>; +def CXXBoolLiteralExpr : DStmt<Expr>; +def CXXNullPtrLiteralExpr : DStmt<Expr>; +def CXXThisExpr : DStmt<Expr>; +def CXXThrowExpr : DStmt<Expr>; +def CXXDefaultArgExpr : DStmt<Expr>; +def CXXScalarValueInitExpr : DStmt<Expr>; +def CXXNewExpr : DStmt<Expr>; +def CXXDeleteExpr : DStmt<Expr>; +def CXXPseudoDestructorExpr : DStmt<Expr>; +def UnaryTypeTraitExpr : DStmt<Expr>; +def DependentScopeDeclRefExpr : DStmt<Expr>; +def CXXConstructExpr : DStmt<Expr>; +def CXXBindTemporaryExpr : DStmt<Expr>; +def CXXBindReferenceExpr : DStmt<Expr>; +def CXXExprWithTemporaries : DStmt<Expr>; +def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>; +def CXXUnresolvedConstructExpr : DStmt<Expr>; +def CXXDependentScopeMemberExpr : DStmt<Expr>; +def OverloadExpr : DStmt<Expr, 1>; +def UnresolvedLookupExpr : DStmt<OverloadExpr>; +def UnresolvedMemberExpr : DStmt<OverloadExpr>; + +// Obj-C Expressions. +def ObjCStringLiteral : DStmt<Expr>; +def ObjCEncodeExpr : DStmt<Expr>; +def ObjCMessageExpr : DStmt<Expr>; +def ObjCSelectorExpr : DStmt<Expr>; +def ObjCProtocolExpr : DStmt<Expr>; +def ObjCIvarRefExpr : DStmt<Expr>; +def ObjCPropertyRefExpr : DStmt<Expr>; +def ObjCImplicitSetterGetterRefExpr : DStmt<Expr>; +def ObjCSuperExpr : DStmt<Expr>; +def ObjCIsaExpr : DStmt<Expr>; + +// Clang Extensions. +def ShuffleVectorExpr : DStmt<Expr>; +def BlockExpr : DStmt<Expr>; +def BlockDeclRefExpr : DStmt<Expr>; diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 00fd9b9..5763a12 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -51,12 +51,14 @@ protected: unsigned char FloatWidth, FloatAlign; unsigned char DoubleWidth, DoubleAlign; unsigned char LongDoubleWidth, LongDoubleAlign; + unsigned char LargeArrayMinWidth, LargeArrayAlign; unsigned char LongWidth, LongAlign; unsigned char LongLongWidth, LongLongAlign; const char *DescriptionString; const char *UserLabelPrefix; const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; + std::string CXXABI; unsigned HasAlignMac68kSupport : 1; @@ -194,6 +196,11 @@ public: return *LongDoubleFormat; } + // getLargeArrayMinWidth/Align - Return the minimum array size that is + // 'large' and its alignment. + unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; } + unsigned getLargeArrayAlign() const { return LargeArrayAlign; } + /// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this /// target, in bits. unsigned getIntMaxTWidth() const { @@ -390,6 +397,11 @@ public: return ""; } + /// getCXXABI - Get the C++ ABI in use. + virtual llvm::StringRef getCXXABI() const { + return CXXABI; + } + /// setCPU - Target the specific CPU. /// /// \return - False on error (invalid CPU name). @@ -406,6 +418,16 @@ public: return false; } + /// setCXXABI - Use this specific C++ ABI. + /// + /// \return - False on error (invalid ABI name). + virtual bool setCXXABI(const std::string &Name) { + if (Name != "itanium" && Name != "microsoft") + return false; + CXXABI = Name; + return true; + } + /// setFeatureEnabled - Enable or disable a specific target feature, /// the feature name must be valid. /// @@ -450,7 +472,12 @@ public: return -1; } - + /// getStaticInitSectionSpecifier - Return the section to use for C++ static + /// initialization functions. + virtual const char *getStaticInitSectionSpecifier() const { + return 0; + } + protected: virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return PointerWidth; diff --git a/include/clang/Basic/TargetOptions.h b/include/clang/Basic/TargetOptions.h index eeaab15..19b0cbb 100644 --- a/include/clang/Basic/TargetOptions.h +++ b/include/clang/Basic/TargetOptions.h @@ -19,6 +19,10 @@ namespace clang { class TargetOptions { public: + TargetOptions() { + CXXABI = "itanium"; + } + /// If given, the name of the target triple to compile for. If not given the /// target will be selected to match the host. std::string Triple; @@ -29,6 +33,10 @@ public: /// If given, the name of the target ABI to use. std::string ABI; + /// If given, the name of the target C++ ABI to use. If not given, defaults + /// to "itanium". + std::string CXXABI; + /// The list of target specific features to enable or disable -- this should /// be a list of strings starting with by '+' or '-'. std::vector<std::string> Features; diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h index b3b6184..9948677 100644 --- a/include/clang/Basic/Version.h +++ b/include/clang/Basic/Version.h @@ -17,15 +17,7 @@ #include "llvm/ADT/StringRef.h" -/// \brief Clang major version -#define CLANG_VERSION_MAJOR 2 - -// FIXME: Updates to this file must also update CMakeLists.txt and VER. -/// \brief Clang minor version -#define CLANG_VERSION_MINOR 0 - -/// \brief Clang patchlevel version -// #define CLANG_VERSION_PATCHLEVEL 1 +#include "clang/Basic/Version.inc" /// \brief Helper macro for CLANG_VERSION_STRING. #define CLANG_MAKE_VERSION_STRING2(X) #X diff --git a/include/clang/Basic/Version.inc.in b/include/clang/Basic/Version.inc.in new file mode 100644 index 0000000..ccf8430 --- /dev/null +++ b/include/clang/Basic/Version.inc.in @@ -0,0 +1,6 @@ +#define CLANG_VERSION @CLANG_VERSION@ +#define CLANG_VERSION_MAJOR @CLANG_VERSION_MAJOR@ +#define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@ +#if @CLANG_HAS_VERSION_PATCHLEVEL@ +#define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@ +#endif diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td new file mode 100644 index 0000000..b42755c --- /dev/null +++ b/include/clang/Basic/arm_neon.td @@ -0,0 +1,341 @@ +//===--- arm_neon.td - ARM NEON compiler interface ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the TableGen definitions from which the ARM NEON header +// file will be generated. See ARM document DUI0348B. +// +//===----------------------------------------------------------------------===// + +class Op; + +def OP_NONE : Op; +def OP_ADD : Op; +def OP_SUB : Op; +def OP_MUL : Op; +def OP_MLA : Op; +def OP_MLS : Op; +def OP_MUL_N : Op; +def OP_MLA_N : Op; +def OP_MLS_N : Op; +def OP_EQ : Op; +def OP_GE : Op; +def OP_LE : Op; +def OP_GT : Op; +def OP_LT : Op; +def OP_NEG : Op; +def OP_NOT : Op; +def OP_AND : Op; +def OP_OR : Op; +def OP_XOR : Op; +def OP_ANDN : Op; +def OP_ORN : Op; +def OP_CAST : Op; +def OP_HI : Op; +def OP_LO : Op; +def OP_CONC : Op; +def OP_DUP : Op; +def OP_SEL : Op; +def OP_REV64 : Op; +def OP_REV32 : Op; +def OP_REV16 : Op; + +class Inst <string p, string t, Op o> { + string Prototype = p; + string Types = t; + Op Operand = o; + bit isShift = 0; +} + +// Used to generate Builtins.def +class SInst<string p, string t> : Inst<p, t, OP_NONE> {} +class IInst<string p, string t> : Inst<p, t, OP_NONE> {} +class WInst<string p, string t> : Inst<p, t, OP_NONE> {} + +// prototype: return (arg, arg, ...) +// v: void +// t: best-fit integer (int/poly args) +// x: signed integer (int/float args) +// u: unsigned integer (int/float args) +// f: float (int args) +// d: default +// w: double width elements, same num elts +// n: double width elements, half num elts +// h: half width elements, double num elts +// e: half width elements, double num elts, unsigned +// i: constant int +// l: constant uint64 +// s: scalar of element type +// a: scalar of element type (splat to vector type) +// k: default elt width, double num elts +// #: array of default vectors +// p: pointer type +// c: const pointer type + +// sizes: +// c: char +// s: short +// i: int +// l: long +// f: float +// h: half-float + +// size modifiers: +// U: unsigned +// Q: 128b +// P: polynomial + +//////////////////////////////////////////////////////////////////////////////// +// E.3.1 Addition +def VADD : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_ADD>; +def VADDL : SInst<"wdd", "csiUcUsUi">; +def VADDW : SInst<"wwd", "csiUcUsUi">; +def VHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VRHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VQADD : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VADDHN : IInst<"dww", "csiUcUsUi">; +def VRADDHN : IInst<"dww", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.2 Multiplication +def VMUL : Inst<"ddd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_MUL>; +def VMLA : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLA>; +def VMLAL : SInst<"wwdd", "csiUcUsUi">; +def VMLS : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLS>; +def VMLSL : SInst<"wwdd", "csiUcUsUi">; +def VQDMULH : SInst<"ddd", "siQsQi">; +def VQRDMULH : SInst<"ddd", "siQsQi">; +def VQDMLAL : SInst<"wwdd", "si">; +def VQDMLSL : SInst<"wwdd", "si">; +def VMULL : SInst<"wdd", "csiUcUsUiPc">; +def VQDMULL : SInst<"wdd", "si">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.3 Subtraction +def VSUB : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_SUB>; +def VSUBL : SInst<"wdd", "csiUcUsUi">; +def VSUBW : SInst<"wwd", "csiUcUsUi">; +def VQSUB : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VHSUB : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VSUBHN : IInst<"dww", "csiUcUsUi">; +def VRSUBHN : IInst<"dww", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.4 Comparison +def VCEQ : Inst<"udd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_EQ>; +def VCGE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GE>; +def VCLE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LE>; +def VCGT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GT>; +def VCLT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LT>; +def VCAGE : IInst<"udd", "fQf">; +def VCALE : IInst<"udd", "fQf">; +def VCAGT : IInst<"udd", "fQf">; +def VCALT : IInst<"udd", "fQf">; +def VTST : WInst<"udd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.5 Absolute Difference +def VABD : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VABDL : SInst<"wdd", "csiUcUsUi">; +def VABA : SInst<"dddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VABAL : SInst<"wwdd", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.6 Max/Min +def VMAX : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VMIN : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.7 Pairdise Addition +def VPADD : IInst<"ddd", "csiUcUsUif">; +def VPADDL : SInst<"nd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VPADAL : SInst<"nnd", "csiUcUsUiQcQsQiQUcQUsQUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.8-9 Folding Max/Min +def VPMAX : SInst<"ddd", "csiUcUsUif">; +def VPMIN : SInst<"ddd", "csiUcUsUif">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.10 Reciprocal/Sqrt +def VRECPS : IInst<"ddd", "fQf">; +def VRSQRTS : IInst<"ddd", "fQf">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.11 Shifts by signed variable +def VSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.12 Shifts by constant +let isShift = 1 in { +def VSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSHL_N : IInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHL_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHLU_N : SInst<"udi", "csilQcQsQiQl">; +def VSHRN_N : IInst<"hki", "silUsUiUl">; +def VQSHRUN_N : SInst<"eki", "sil">; +def VQRSHRUN_N : SInst<"eki", "sil">; +def VQSHRN_N : SInst<"hki", "silUsUiUl">; +def VRSHRN_N : IInst<"hki", "silUsUiUl">; +def VQRSHRN_N : SInst<"hki", "silUsUiUl">; +def VSHLL_N : SInst<"wdi", "csiUcUsUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.13 Shifts with insert +def VSRI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; +def VSLI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; +} + +//////////////////////////////////////////////////////////////////////////////// +// E.3.14 Loads and stores of a single vector +def VLD1 : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1_LANE : WInst<"dcdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1_DUP : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST1 : WInst<"vpd", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST1_LANE : WInst<"vpdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.15 Loads and stores of an N-element structure +def VLD2 : WInst<"2c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD3 : WInst<"3c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD4 : WInst<"4c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD2_DUP : WInst<"2c", "UcUsUiUlcsilhfPcPs">; +def VLD3_DUP : WInst<"3c", "UcUsUiUlcsilhfPcPs">; +def VLD4_DUP : WInst<"4c", "UcUsUiUlcsilhfPcPs">; +def VLD2_LANE : WInst<"2c2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD3_LANE : WInst<"3c3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD4_LANE : WInst<"4c4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST2 : WInst<"vp2", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST3 : WInst<"vp3", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST4 : WInst<"vp4", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST2_LANE : WInst<"vp2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST3_LANE : WInst<"vp3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST4_LANE : WInst<"vp4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.16 Extract lanes from a vector +def VGET_LANE : IInst<"sdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.17 Set lanes within a vector +def VSET_LANE : IInst<"dsdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.18 Initialize a vector from bit pattern +def VCREATE: Inst<"dl", "csihfUcUsUiUlPcPsl", OP_CAST>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.19 Set all lanes to same value +def VDUP_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; +def VMOV_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.20 Combining vectors +def VCOMBINE : Inst<"kdd", "csilhfUcUsUiUlPcPs", OP_CONC>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.21 Splitting vectors +def VGET_HIGH : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_HI>; +def VGET_LOW : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_LO>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.22 Converting vectors +def VCVT_S32 : SInst<"xd", "fQf">; +def VCVT_U32 : SInst<"ud", "fQf">; +def VCVT_F16 : SInst<"hk", "f">; +def VCVT_N_S32 : SInst<"xdi", "fQf">; +def VCVT_N_U32 : SInst<"udi", "fQf">; +def VCVT_F32 : SInst<"fd", "iUiQiQUi">; +def VCVT_F32_F16 : SInst<"kh", "f">; +def VCVT_N_F32 : SInst<"fdi", "iUiQiQUi">; +def VMOVN : IInst<"hk", "silUsUiUl">; +def VMOVL : SInst<"wd", "csiUcUsUi">; +def VQMOVN : SInst<"hk", "silUsUiUl">; +def VQMOVUN : SInst<"ek", "sil">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.23-24 Table lookup, Extended table lookup +def VTBL1 : WInst<"ddt", "UccPc">; +def VTBL2 : WInst<"d2t", "UccPc">; +def VTBL3 : WInst<"d3t", "UccPc">; +def VTBL4 : WInst<"d4t", "UccPc">; +def VTBX1 : WInst<"dddt", "UccPc">; +def VTBX2 : WInst<"dd2t", "UccPc">; +def VTBX3 : WInst<"dd3t", "UccPc">; +def VTBX4 : WInst<"dd4t", "UccPc">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.25 Operations with a scalar value +def VMLA_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">; +def VMLAL_LANE : SInst<"wwddi", "siUsUi">; +def VQDMLAL_LANE : SInst<"wwddi", "si">; +def VMLS_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">; +def VMLSL_LANE : SInst<"wwddi", "siUsUi">; +def VQDMLSL_LANE : SInst<"wwddi", "si">; +def VMUL_N : Inst<"dds", "sifUsUiQsQiQfQUsQUi", OP_MUL_N>; +def VMULL_N : SInst<"wda", "siUsUi">; +def VMULL_LANE : SInst<"wddi", "siUsUi">; +def VQDMULL_N : SInst<"wda", "si">; +def VQDMULL_LANE : SInst<"wddi", "si">; +def VQDMULH_N : SInst<"dda", "siQsQi">; +def VQDMULH_LANE : SInst<"dddi", "siQsQi">; +def VQRDMULH_N : SInst<"dda", "siQsQi">; +def VQRDMULH_LANE : SInst<"dddi", "siQsQi">; +def VMLA_N : Inst<"ddda", "siUsUifQsQiQUsQUiQf", OP_MLA_N>; +def VMLAL_N : SInst<"wwda", "siUsUi">; +def VQDMLAL_N : SInst<"wwda", "si">; +def VMLS_N : Inst<"ddds", "siUsUifQsQiQUsQUiQf", OP_MLS_N>; +def VMLSL_N : SInst<"wwda", "siUsUi">; +def VQDMLSL_N : SInst<"wwda", "si">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.26 Vector Extract +def VEXT : WInst<"dddi", "cUcPcsUsPsiUilUlQcQUcQPcQsQUsQPsQiQUiQlQUl">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.27 Reverse vector elements (sdap endianness) +def VREV64 : Inst<"dd", "csiUcUsUiPcPsfQcQsQiQUcQUsQUiQPcQPsQf", OP_REV64>; +def VREV32 : Inst<"dd", "csUcUsPcQcQsQUcQUsQPc", OP_REV32>; +def VREV16 : Inst<"dd", "cUcPcQcQUcQPc", OP_REV16>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.28 Other single operand arithmetic +def VABS : SInst<"dd", "csifQcQsQiQf">; +def VQABS : SInst<"dd", "csiQcQsQi">; +def VNEG : Inst<"dd", "csifQcQsQiQf", OP_NEG>; +def VQNEG : SInst<"dd", "csiQcQsQi">; +def VCLS : SInst<"dd", "csiQcQsQi">; +def VCLZ : IInst<"dd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VCNT : WInst<"dd", "UccPcQUcQcQPc">; +def VRECPE : SInst<"dd", "fUiQfQUi">; +def VRSQRTE : SInst<"dd", "fUiQfQUi">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.29 Logical operations +def VMVN : Inst<"dd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc", OP_NOT>; +def VAND : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_AND>; +def VORR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_OR>; +def VEOR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_XOR>; +def VBIC : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ANDN>; +def VORN : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ORN>; +def VBSL : Inst<"dudd", "csilUcUsUiUlfPcPsQcQsQiQlQUcQUsQUiQUlQfQPcQPs", OP_SEL>; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.30 Transposition operations +def VTRN: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VZIP: WInst<"2dd", "csUcUsfPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VUZP: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; + +//////////////////////////////////////////////////////////////////////////////// +// E.3.31 Vector reinterpret cast operations |