Roll back r104941.

llvm-svn: 104990
This commit is contained in:
John McCall 2010-05-28 18:25:28 +00:00
parent 64824ea99f
commit 61d8258fa3
11 changed files with 6 additions and 59 deletions

View File

@ -1999,11 +1999,6 @@ class RecordDecl : public TagDecl {
/// containing an object. /// containing an object.
bool HasObjectMember : 1; bool HasObjectMember : 1;
/// InvisibleToADL - This is true if this struct is invisible to
/// argument-dependent lookup. Certain builtin types have this
/// property.
bool InvisibleToADL : 1;
protected: protected:
RecordDecl(Kind DK, TagKind TK, DeclContext *DC, RecordDecl(Kind DK, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id, SourceLocation L, IdentifierInfo *Id,
@ -2046,18 +2041,6 @@ public:
bool hasObjectMember() const { return HasObjectMember; } bool hasObjectMember() const { return HasObjectMember; }
void setHasObjectMember (bool val) { HasObjectMember = val; } void setHasObjectMember (bool val) { HasObjectMember = val; }
/// \brief Determines whether this type is invisible to C++
/// argument-dependent lookup.
///
/// Types with this bit set behave like fundamental types: they are
/// never associated classes, and they do not add their contexts as
/// associated namespaces.
///
/// This can be specified in user code as __attribute__((adl_invisible)),
/// but it's generally better not to.
bool isInvisibleToADL() const { return InvisibleToADL; }
void setInvisibleToADL(bool val = true) { InvisibleToADL = val; }
/// \brief Determines whether this declaration represents the /// \brief Determines whether this declaration represents the
/// injected class name. /// injected class name.
/// ///

View File

@ -884,9 +884,9 @@ def warn_attribute_wrong_decl_type : Warning<
def err_attribute_wrong_decl_type : Error< def err_attribute_wrong_decl_type : Error<
"%0 attribute only applies to %select{function|union|" "%0 attribute only applies to %select{function|union|"
"variable and function|function or method|parameter|" "variable and function|function or method|parameter|"
"parameter or Objective-C method|function, method or block|" "parameter or Objective-C method |function, method or block|"
"virtual method or class|function, method, or parameter|class|virtual method" "virtual method or class|function, method, or parameter|class|virtual method"
"|member|struct or union}1 types">; "|member}1 types">;
def warn_function_attribute_wrong_type : Warning< def warn_function_attribute_wrong_type : Warning<
"%0 only applies to function types; type here is %1">; "%0 only applies to function types; type here is %1">;
def warn_gnu_inline_attribute_requires_inline : Warning< def warn_gnu_inline_attribute_requires_inline : Warning<

View File

@ -115,7 +115,6 @@ public:
AT_weakref, AT_weakref,
AT_weak_import, AT_weak_import,
AT_reqd_wg_size, AT_reqd_wg_size,
AT_adl_invisible,
IgnoredAttribute, IgnoredAttribute,
UnknownAttribute UnknownAttribute
}; };

View File

@ -1596,7 +1596,6 @@ RecordDecl::RecordDecl(Kind DK, TagKind TK, DeclContext *DC, SourceLocation L,
HasFlexibleArrayMember = false; HasFlexibleArrayMember = false;
AnonymousStructOrUnion = false; AnonymousStructOrUnion = false;
HasObjectMember = false; HasObjectMember = false;
InvisibleToADL = false;
assert(classof(static_cast<Decl*>(this)) && "Invalid Kind!"); assert(classof(static_cast<Decl*>(this)) && "Invalid Kind!");
} }

View File

@ -1272,7 +1272,7 @@ public:
" unsigned fp_offset;" " unsigned fp_offset;"
" void* overflow_arg_area;" " void* overflow_arg_area;"
" void* reg_save_area;" " void* reg_save_area;"
"} __attribute__((adl_invisible)) __va_list_tag;" "} __va_list_tag;"
"typedef __va_list_tag __builtin_va_list[1];"; "typedef __va_list_tag __builtin_va_list[1];";
} }

View File

@ -171,7 +171,6 @@ void PCHDeclReader::VisitRecordDecl(RecordDecl *RD) {
RD->setHasFlexibleArrayMember(Record[Idx++]); RD->setHasFlexibleArrayMember(Record[Idx++]);
RD->setAnonymousStructOrUnion(Record[Idx++]); RD->setAnonymousStructOrUnion(Record[Idx++]);
RD->setHasObjectMember(Record[Idx++]); RD->setHasObjectMember(Record[Idx++]);
RD->setInvisibleToADL(Record[Idx++]);
} }
void PCHDeclReader::VisitValueDecl(ValueDecl *VD) { void PCHDeclReader::VisitValueDecl(ValueDecl *VD) {

View File

@ -169,7 +169,6 @@ void PCHDeclWriter::VisitRecordDecl(RecordDecl *D) {
Record.push_back(D->hasFlexibleArrayMember()); Record.push_back(D->hasFlexibleArrayMember());
Record.push_back(D->isAnonymousStructOrUnion()); Record.push_back(D->isAnonymousStructOrUnion());
Record.push_back(D->hasObjectMember()); Record.push_back(D->hasObjectMember());
Record.push_back(D->isInvisibleToADL());
Code = pch::DECL_RECORD; Code = pch::DECL_RECORD;
} }

View File

@ -120,7 +120,6 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
.Case("cf_returns_retained", AT_cf_returns_retained) .Case("cf_returns_retained", AT_cf_returns_retained)
.Case("reqd_work_group_size", AT_reqd_wg_size) .Case("reqd_work_group_size", AT_reqd_wg_size)
.Case("no_instrument_function", AT_no_instrument_function) .Case("no_instrument_function", AT_no_instrument_function)
.Case("adl_invisible", AT_adl_invisible)
.Case("thiscall", AT_thiscall) .Case("thiscall", AT_thiscall)
.Case("__cdecl", AT_cdecl) .Case("__cdecl", AT_cdecl)
.Case("__stdcall", AT_stdcall) .Case("__stdcall", AT_stdcall)

View File

@ -703,7 +703,7 @@ static void HandleObjCExceptionAttr(Decl *D, const AttributeList &Attr,
static void HandleObjCNSObject(Decl *D, const AttributeList &Attr, Sema &S) { static void HandleObjCNSObject(Decl *D, const AttributeList &Attr, Sema &S) {
if (Attr.getNumArgs() != 0) { if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return; return;
} }
if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) { if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
@ -720,7 +720,7 @@ static void HandleObjCNSObject(Decl *D, const AttributeList &Attr, Sema &S) {
static void static void
HandleOverloadableAttr(Decl *D, const AttributeList &Attr, Sema &S) { HandleOverloadableAttr(Decl *D, const AttributeList &Attr, Sema &S) {
if (Attr.getNumArgs() != 0) { if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return; return;
} }
@ -732,21 +732,6 @@ HandleOverloadableAttr(Decl *D, const AttributeList &Attr, Sema &S) {
D->addAttr(::new (S.Context) OverloadableAttr()); D->addAttr(::new (S.Context) OverloadableAttr());
} }
static void HandleADLInvisibleAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
if (!isa<RecordDecl>(d)) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
<< "adl_invisible" << 12;
return;
}
cast<RecordDecl>(d)->setInvisibleToADL();
}
static void HandleBlocksAttr(Decl *d, const AttributeList &Attr, Sema &S) { static void HandleBlocksAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (!Attr.getParameterName()) { if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
@ -956,7 +941,7 @@ static void HandleReqdWorkGroupSize(Decl *D, const AttributeList &Attr,
Sema &S) { Sema &S) {
// Attribute has 3 arguments. // Attribute has 3 arguments.
if (Attr.getNumArgs() != 3) { if (Attr.getNumArgs() != 3) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 3; S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return; return;
} }
@ -1984,7 +1969,6 @@ static void ProcessDeclAttribute(Scope *scope, Decl *D,
HandleObjCExceptionAttr(D, Attr, S); HandleObjCExceptionAttr(D, Attr, S);
break; break;
case AttributeList::AT_overloadable:HandleOverloadableAttr(D, Attr, S); break; case AttributeList::AT_overloadable:HandleOverloadableAttr(D, Attr, S); break;
case AttributeList::AT_adl_invisible: HandleADLInvisibleAttr(D, Attr, S); break;
case AttributeList::AT_nsobject: HandleObjCNSObject (D, Attr, S); break; case AttributeList::AT_nsobject: HandleObjCNSObject (D, Attr, S); break;
case AttributeList::AT_blocks: HandleBlocksAttr (D, Attr, S); break; case AttributeList::AT_blocks: HandleBlocksAttr (D, Attr, S); break;
case AttributeList::AT_sentinel: HandleSentinelAttr (D, Attr, S); break; case AttributeList::AT_sentinel: HandleSentinelAttr (D, Attr, S); break;

View File

@ -1500,10 +1500,6 @@ addAssociatedClassesAndNamespaces(CXXRecordDecl *Class,
ASTContext &Context, ASTContext &Context,
Sema::AssociatedNamespaceSet &AssociatedNamespaces, Sema::AssociatedNamespaceSet &AssociatedNamespaces,
Sema::AssociatedClassSet &AssociatedClasses) { Sema::AssociatedClassSet &AssociatedClasses) {
// Some classes are invisible to ADL.
if (Class->isInvisibleToADL()) return;
// C++ [basic.lookup.koenig]p2: // C++ [basic.lookup.koenig]p2:
// [...] // [...]
// -- If T is a class type (including unions), its associated // -- If T is a class type (including unions), its associated

View File

@ -97,14 +97,3 @@ namespace test5 {
foo(&bar); foo(&bar);
} }
} }
// PR6762: __builtin_va_list should be invisible to ADL on all platforms.
void test6_function(__builtin_va_list &argv);
namespace test6 {
void test6_function(__builtin_va_list &argv);
void test() {
__builtin_va_list args;
test6_function(args);
}
}