Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rd180746 r65dc863  
    1 #include <stddef.h>                // for NULL
    2 #include <algorithm>               // for find, all_of
    3 #include <cassert>                 // for assertf, assert, safe_dynamic_cast
    4 #include <iostream>                // for ostream, cerr, endl
    5 #include <iterator>                // for back_insert_iterator, back_inserter
    6 #include <memory>                  // for __shared_ptr
    7 
    8 #include "Common/SemanticError.h"  // for SemanticError
    9 #include "Common/UniqueName.h"     // for UniqueName
    10 #include "Common/utility.h"        // for toString, deleteAll, maybeClone
    11 #include "GenPoly/GenPoly.h"       // for getFunctionType
     1#include <algorithm>
    122#include "InitTweak.h"
    13 #include "Parser/LinkageSpec.h"    // for Spec, isBuiltin, Intrinsic
    14 #include "ResolvExpr/typeops.h"    // for typesCompatibleIgnoreQualifiers
    15 #include "SymTab/Indexer.h"        // for Indexer
    16 #include "SynTree/Attribute.h"     // for Attribute
    17 #include "SynTree/Constant.h"      // for Constant
    18 #include "SynTree/Declaration.h"   // for ObjectDecl, DeclarationWithType
    19 #include "SynTree/Expression.h"    // for Expression, UntypedExpr, Applicati...
    20 #include "SynTree/Initializer.h"   // for Initializer, ListInit, Designation
    21 #include "SynTree/Label.h"         // for Label, noLabels
    22 #include "SynTree/Statement.h"     // for CompoundStmt, ExprStmt, BranchStmt
    23 #include "SynTree/Type.h"          // for FunctionType, ArrayType, PointerType
    24 #include "SynTree/Visitor.h"       // for Visitor, maybeAccept
    25 
    26 class UntypedValofExpr;
     3#include "SynTree/Visitor.h"
     4#include "SynTree/Statement.h"
     5#include "SynTree/Initializer.h"
     6#include "SynTree/Expression.h"
     7#include "SynTree/Attribute.h"
     8#include "GenPoly/GenPoly.h"
     9#include "ResolvExpr/typeops.h"
    2710
    2811namespace InitTweak {
     
    3114                public:
    3215                        bool hasDesignations = false;
    33                         virtual void visit( Designation * des ) {
    34                                 if ( ! des->get_designators().empty() ) hasDesignations = true;
    35                                 else Visitor::visit( des );
    36                         }
     16                        template<typename Init>
     17                        void handleInit( Init * init ) {
     18                                if ( ! init->get_designators().empty() ) hasDesignations = true;
     19                                else Visitor::visit( init );
     20                        }
     21                        virtual void visit( SingleInit * singleInit ) { handleInit( singleInit); }
     22                        virtual void visit( ListInit * listInit ) { handleInit( listInit); }
    3723                };
    3824
Note: See TracChangeset for help on using the changeset viewer.