forked from OSchip/llvm-project
parent
076b7fc608
commit
33ebfe36e5
|
@ -152,7 +152,7 @@ def AddressSpace : Attr {
|
||||||
|
|
||||||
def Alias : InheritableAttr {
|
def Alias : InheritableAttr {
|
||||||
let Spellings = [GNU<"alias">, CXX11<"gnu", "alias">];
|
let Spellings = [GNU<"alias">, CXX11<"gnu", "alias">];
|
||||||
let Args = [IdentifierArgument<"Aliasee">];
|
let Args = [StringArgument<"Aliasee">];
|
||||||
}
|
}
|
||||||
|
|
||||||
def Aligned : InheritableAttr {
|
def Aligned : InheritableAttr {
|
||||||
|
@ -184,7 +184,7 @@ def AlwaysInline : InheritableAttr {
|
||||||
def TLSModel : InheritableAttr {
|
def TLSModel : InheritableAttr {
|
||||||
let Spellings = [GNU<"tls_model">, CXX11<"gnu", "tls_model">];
|
let Spellings = [GNU<"tls_model">, CXX11<"gnu", "tls_model">];
|
||||||
let Subjects = [Var];
|
let Subjects = [Var];
|
||||||
let Args = [IdentifierArgument<"Model">];
|
let Args = [StringArgument<"Model">];
|
||||||
}
|
}
|
||||||
|
|
||||||
def AnalyzerNoReturn : InheritableAttr {
|
def AnalyzerNoReturn : InheritableAttr {
|
||||||
|
@ -373,7 +373,7 @@ def MinSize : InheritableAttr {
|
||||||
|
|
||||||
def Format : InheritableAttr {
|
def Format : InheritableAttr {
|
||||||
let Spellings = [GNU<"format">, CXX11<"gnu", "format">];
|
let Spellings = [GNU<"format">, CXX11<"gnu", "format">];
|
||||||
let Args = [IdentifierArgument<"Type">, IntArgument<"FormatIdx">,
|
let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">,
|
||||||
IntArgument<"FirstArg">];
|
IntArgument<"FirstArg">];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
clang_tablegen(AttrExprArgs.inc -gen-clang-attr-expr-args-list
|
|
||||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
|
||||||
SOURCE ../Basic/Attr.td
|
|
||||||
TARGET ClangAttrExprArgs)
|
|
||||||
|
|
||||||
clang_tablegen(AttrLateParsed.inc -gen-clang-attr-late-parsed-list
|
clang_tablegen(AttrLateParsed.inc -gen-clang-attr-late-parsed-list
|
||||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||||
SOURCE ../Basic/Attr.td
|
SOURCE ../Basic/Attr.td
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
CLANG_LEVEL := ../../..
|
CLANG_LEVEL := ../../..
|
||||||
TD_SRC_DIR = $(PROJ_SRC_DIR)/../Basic
|
TD_SRC_DIR = $(PROJ_SRC_DIR)/../Basic
|
||||||
BUILT_SOURCES = AttrExprArgs.inc AttrLateParsed.inc
|
BUILT_SOURCES = AttrLateParsed.inc
|
||||||
|
|
||||||
TABLEGEN_INC_FILES_COMMON = 1
|
TABLEGEN_INC_FILES_COMMON = 1
|
||||||
|
|
||||||
include $(CLANG_LEVEL)/Makefile
|
include $(CLANG_LEVEL)/Makefile
|
||||||
|
|
||||||
$(ObjDir)/AttrExprArgs.inc.tmp : $(TD_SRC_DIR)/Attr.td $(CLANG_TBLGEN) \
|
|
||||||
$(ObjDir)/.dir
|
|
||||||
$(Echo) "Building Clang attribute expression arguments table with tblgen"
|
|
||||||
$(Verb) $(ClangTableGen) -gen-clang-attr-expr-args-list -o $(call SYSPATH, $@) \
|
|
||||||
-I $(PROJ_SRC_DIR)/../../ $<
|
|
||||||
|
|
||||||
$(ObjDir)/AttrLateParsed.inc.tmp : $(TD_SRC_DIR)/Attr.td $(CLANG_TBLGEN) \
|
$(ObjDir)/AttrLateParsed.inc.tmp : $(TD_SRC_DIR)/Attr.td $(CLANG_TBLGEN) \
|
||||||
$(ObjDir)/.dir
|
$(ObjDir)/.dir
|
||||||
$(Echo) "Building Clang attribute late-parsed table with tblgen"
|
$(Echo) "Building Clang attribute late-parsed table with tblgen"
|
||||||
|
|
|
@ -17,7 +17,6 @@ add_clang_library(clangParse
|
||||||
|
|
||||||
add_dependencies(clangParse
|
add_dependencies(clangParse
|
||||||
ClangAttrClasses
|
ClangAttrClasses
|
||||||
ClangAttrExprArgs
|
|
||||||
ClangAttrLateParsed
|
ClangAttrLateParsed
|
||||||
ClangAttrList
|
ClangAttrList
|
||||||
ClangAttrParsedAttrList
|
ClangAttrParsedAttrList
|
||||||
|
|
|
@ -178,12 +178,6 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Determine whether the given attribute has all expression arguments.
|
|
||||||
static bool attributeHasExprArgs(const IdentifierInfo &II) {
|
|
||||||
return llvm::StringSwitch<bool>(II.getName())
|
|
||||||
#include "clang/Parse/AttrExprArgs.inc"
|
|
||||||
.Default(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parse the arguments to a parameterized GNU attribute or
|
/// Parse the arguments to a parameterized GNU attribute or
|
||||||
/// a C++11 attribute in "gnu" namespace.
|
/// a C++11 attribute in "gnu" namespace.
|
||||||
|
@ -253,10 +247,6 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
|
||||||
TypeParsed = true;
|
TypeParsed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If the attribute has all expression arguments, and not a "parameter",
|
|
||||||
// break out to handle it below.
|
|
||||||
if (attributeHasExprArgs(*AttrName))
|
|
||||||
break;
|
|
||||||
ParmName = Tok.getIdentifierInfo();
|
ParmName = Tok.getIdentifierInfo();
|
||||||
ParmLoc = ConsumeToken();
|
ParmLoc = ConsumeToken();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10633,8 +10633,8 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
|
||||||
// FIXME: We need to pass in the attributes given an AST
|
// FIXME: We need to pass in the attributes given an AST
|
||||||
// representation, not a parser representation.
|
// representation, not a parser representation.
|
||||||
if (D) {
|
if (D) {
|
||||||
// FIXME: The current scope is almost... but not entirely... correct here.
|
// FIXME: What to pass instead of TUScope?
|
||||||
ProcessDeclAttributes(getCurScope(), NewFD, *D);
|
ProcessDeclAttributes(TUScope, NewFD, *D);
|
||||||
|
|
||||||
if (NewFD->hasAttrs())
|
if (NewFD->hasAttrs())
|
||||||
CheckAlignasUnderalignment(NewFD);
|
CheckAlignasUnderalignment(NewFD);
|
||||||
|
|
|
@ -14,7 +14,7 @@ union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'form
|
||||||
enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
|
enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
|
||||||
|
|
||||||
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
|
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
|
||||||
extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{use of undeclared identifier 'foo'}}
|
extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{attribute takes one argument}}
|
||||||
|
|
||||||
/* format_arg formats must take and return a string. */
|
/* format_arg formats must take and return a string. */
|
||||||
extern NSString *fi0 (int) __attribute__((format_arg(1))); // expected-error {{format argument not a string type}}
|
extern NSString *fi0 (int) __attribute__((format_arg(1))); // expected-error {{format argument not a string type}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -std=gnu++11 -fsyntax-only -verify %s
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
|
|
||||||
namespace attribute_aligned {
|
namespace attribute_aligned {
|
||||||
template<int N>
|
template<int N>
|
||||||
|
@ -18,26 +18,6 @@ namespace attribute_aligned {
|
||||||
check_alignment<2>::t c2;
|
check_alignment<2>::t c2;
|
||||||
check_alignment<3>::t c3; // expected-note 2 {{in instantiation}}
|
check_alignment<3>::t c3; // expected-note 2 {{in instantiation}}
|
||||||
check_alignment<4>::t c4;
|
check_alignment<4>::t c4;
|
||||||
|
|
||||||
template<unsigned Size, unsigned Align>
|
|
||||||
class my_aligned_storage
|
|
||||||
{
|
|
||||||
__attribute__((align(Align))) char storage[Size];
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class C {
|
|
||||||
public:
|
|
||||||
C() {
|
|
||||||
static_assert(sizeof(t) == sizeof(T), "my_aligned_storage size wrong");
|
|
||||||
static_assert(alignof(t) == alignof(T), "my_aligned_storage align wrong"); // expected-warning{{'alignof' applied to an expression is a GNU extension}}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
my_aligned_storage<sizeof(T), alignof(T)> t;
|
|
||||||
};
|
|
||||||
|
|
||||||
C<double> cd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PR9049 {
|
namespace PR9049 {
|
||||||
|
|
|
@ -971,49 +971,6 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
OS << "#endif\n";
|
OS << "#endif\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emits the LateParsed property for attributes.
|
|
||||||
void EmitClangAttrExprArgsList(RecordKeeper &Records, raw_ostream &OS) {
|
|
||||||
emitSourceFileHeader("llvm::StringSwitch code to match attributes with "
|
|
||||||
"expression arguments", OS);
|
|
||||||
|
|
||||||
std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
|
|
||||||
|
|
||||||
for (std::vector<Record*>::iterator I = Attrs.begin(), E = Attrs.end();
|
|
||||||
I != E; ++I) {
|
|
||||||
Record &Attr = **I;
|
|
||||||
|
|
||||||
// Determine whether the first argument is something that is always
|
|
||||||
// an expression.
|
|
||||||
std::vector<Record *> Args = Attr.getValueAsListOfDefs("Args");
|
|
||||||
if (Args.empty() || Args[0]->getSuperClasses().empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Check whether this is one of the argument kinds that implies an
|
|
||||||
// expression.
|
|
||||||
// FIXME: Aligned is weird.
|
|
||||||
if (!llvm::StringSwitch<bool>(Args[0]->getSuperClasses().back()->getName())
|
|
||||||
.Case("AlignedArgument", true)
|
|
||||||
.Case("BoolArgument", true)
|
|
||||||
.Case("DefaultIntArgument", true)
|
|
||||||
.Case("IntArgument", true)
|
|
||||||
.Case("StringArgument", true)
|
|
||||||
.Case("ExprArgument", true)
|
|
||||||
.Case("UnsignedArgument", true)
|
|
||||||
.Case("VariadicUnsignedArgument", true)
|
|
||||||
.Case("VariadicExprArgument", true)
|
|
||||||
.Default(false))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::vector<Record*> Spellings = Attr.getValueAsListOfDefs("Spellings");
|
|
||||||
|
|
||||||
for (std::vector<Record*>::const_iterator I = Spellings.begin(),
|
|
||||||
E = Spellings.end(); I != E; ++I) {
|
|
||||||
OS << ".Case(\"" << (*I)->getValueAsString("Name") << "\", "
|
|
||||||
<< "true" << ")\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Emits the class method definitions for attributes.
|
// Emits the class method definitions for attributes.
|
||||||
void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
|
||||||
emitSourceFileHeader("Attribute classes' member function definitions", OS);
|
emitSourceFileHeader("Attribute classes' member function definitions", OS);
|
||||||
|
|
|
@ -24,7 +24,6 @@ using namespace clang;
|
||||||
|
|
||||||
enum ActionType {
|
enum ActionType {
|
||||||
GenClangAttrClasses,
|
GenClangAttrClasses,
|
||||||
GenClangAttrExprArgsList,
|
|
||||||
GenClangAttrImpl,
|
GenClangAttrImpl,
|
||||||
GenClangAttrList,
|
GenClangAttrList,
|
||||||
GenClangAttrPCHRead,
|
GenClangAttrPCHRead,
|
||||||
|
@ -63,10 +62,6 @@ namespace {
|
||||||
"Generate option parser implementation"),
|
"Generate option parser implementation"),
|
||||||
clEnumValN(GenClangAttrClasses, "gen-clang-attr-classes",
|
clEnumValN(GenClangAttrClasses, "gen-clang-attr-classes",
|
||||||
"Generate clang attribute clases"),
|
"Generate clang attribute clases"),
|
||||||
clEnumValN(GenClangAttrExprArgsList,
|
|
||||||
"gen-clang-attr-expr-args-list",
|
|
||||||
"Generate a clang attribute expression "
|
|
||||||
"arguments list"),
|
|
||||||
clEnumValN(GenClangAttrImpl, "gen-clang-attr-impl",
|
clEnumValN(GenClangAttrImpl, "gen-clang-attr-impl",
|
||||||
"Generate clang attribute implementations"),
|
"Generate clang attribute implementations"),
|
||||||
clEnumValN(GenClangAttrList, "gen-clang-attr-list",
|
clEnumValN(GenClangAttrList, "gen-clang-attr-list",
|
||||||
|
@ -148,9 +143,6 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
|
||||||
case GenClangAttrClasses:
|
case GenClangAttrClasses:
|
||||||
EmitClangAttrClass(Records, OS);
|
EmitClangAttrClass(Records, OS);
|
||||||
break;
|
break;
|
||||||
case GenClangAttrExprArgsList:
|
|
||||||
EmitClangAttrExprArgsList(Records, OS);
|
|
||||||
break;
|
|
||||||
case GenClangAttrImpl:
|
case GenClangAttrImpl:
|
||||||
EmitClangAttrImpl(Records, OS);
|
EmitClangAttrImpl(Records, OS);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,7 +30,6 @@ void EmitClangASTNodes(RecordKeeper &RK, raw_ostream &OS,
|
||||||
const std::string &N, const std::string &S);
|
const std::string &N, const std::string &S);
|
||||||
|
|
||||||
void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS);
|
void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS);
|
||||||
void EmitClangAttrExprArgsList(RecordKeeper &Records, raw_ostream &OS);
|
|
||||||
void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS);
|
void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS);
|
||||||
void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS);
|
void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS);
|
||||||
void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS);
|
void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS);
|
||||||
|
|
Loading…
Reference in New Issue