Ignore:
Timestamp:
Jul 13, 2018, 2:33:18 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
ad64520, b1672e1
Parents:
610194e
Message:

Add temporary warning for deprecated anonymous member declarations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r610194e r2e02851  
    10031003                                // };
    10041004                                if ( ! (extracted && decl->name == "" && ! anon) ) {
     1005                                        if (decl->name == "") {
     1006                                                if ( DeclarationWithType * dwt = dynamic_cast<DeclarationWithType *>( decl ) ) {
     1007                                                        if ( ReferenceToType * aggr = dynamic_cast<ReferenceToType *>( dwt->get_type() ) ) {
     1008                                                                if ( aggr->name.find("anonymous") == std::string::npos ) {
     1009                                                                        bool isInline = false;
     1010                                                                        if (cur->type->kind == TypeData::Aggregate || cur->type->kind == TypeData::AggregateInst) {
     1011                                                                                if (cur->type->kind == TypeData::Aggregate) {
     1012                                                                                        isInline = cur->type->aggregate.inLine;
     1013                                                                                } else {
     1014                                                                                        isInline = cur->type->aggInst.inLine;
     1015                                                                                        if ( TypeData * aggr = cur->type->aggInst.aggregate ) {
     1016                                                                                                if ( aggr->kind == TypeData::Aggregate ) {
     1017                                                                                                        isInline = isInline || aggr->aggregate.inLine;
     1018                                                                                                }
     1019                                                                                        }
     1020                                                                                }
     1021                                                                        }
     1022                                                                        if (! isInline) {
     1023                                                                                // temporary: warn about anonymous member declarations of named types, since this conflicts with the syntax for the forward declaration of an anonymous type
     1024                                                                                SemanticWarning( cur->location, Warning::AggrForwardDecl, aggr->name.c_str() );
     1025                                                                        }
     1026                                                                }
     1027                                                        }
     1028                                                }
     1029                                        }
    10051030                                        decl->location = cur->location;
    10061031                                        * out++ = decl;
Note: See TracChangeset for help on using the changeset viewer.