Changeset 30f9072 for src/SymTab/Validate.cc
- Timestamp:
- Jul 12, 2017, 1:58:00 PM (7 years ago)
- 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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 02d62bb
- Parents:
- 3268a58
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r3268a58 r30f9072 38 38 // definition occurs later in the input. 39 39 40 #include <algorithm>41 #include <iterator>42 #include <list>43 44 #include "CodeGen/CodeGenerator.h"45 46 #include "Common/PassVisitor.h"47 #include "Common/ScopedMap.h"48 #include "Common/UniqueName.h"49 #include "Common/utility.h"50 51 #include "Concurrency/Keywords.h"52 53 #include "GenPoly/DeclMutator.h"54 55 #include "InitTweak/InitTweak.h"56 57 #include "AddVisit.h"58 #include "Autogen.h"59 #include "FixFunction.h"60 // #include "ImplementationType.h"61 #include "Indexer.h"62 #include "MakeLibCfa.h"63 #include "TypeEquality.h"64 40 #include "Validate.h" 65 41 66 #include "ResolvExpr/typeops.h" 67 68 #include "SynTree/Attribute.h" 69 #include "SynTree/Expression.h" 70 #include "SynTree/Mutator.h" 71 #include "SynTree/Statement.h" 72 #include "SynTree/Type.h" 73 #include "SynTree/TypeSubstitution.h" 74 #include "SynTree/Visitor.h" 42 #include <cstddef> // for size_t 43 #include <algorithm> // for move, transform 44 #include <cassert> // for safe_dynamic_cast, assertf 45 #include <iterator> // for back_inserter, inserter, back_... 46 #include <list> // for list, _List_iterator, list<>::... 47 #include <map> // for _Rb_tree_iterator, map, map<>:... 48 #include <memory> // for unique_ptr, allocator 49 #include <string> // for string, operator+, operator== 50 #include <tuple> // for get 51 #include <utility> // for pair, make_pair 52 53 #include "AddVisit.h" // for addVisit 54 #include "Autogen.h" // for SizeType, autogenerateRoutines 55 #include "CodeGen/CodeGenerator.h" // for genName 56 #include "Common/PassVisitor.h" // for PassVisitor, WithDeclsToAdd 57 #include "Common/ScopedMap.h" // for ScopedMap<>::const_iterator 58 #include "Common/SemanticError.h" // for SemanticError 59 #include "Common/UniqueName.h" // for UniqueName 60 #include "Common/utility.h" // for operator+, cloneAll, deleteAll 61 #include "Concurrency/Keywords.h" // for applyKeywords, implementMutexF... 62 #include "FixFunction.h" // for FixFunction 63 #include "Indexer.h" // for Indexer 64 #include "InitTweak/InitTweak.h" // for isCtorDtor, isCtorDtorAssign 65 #include "Parser/LinkageSpec.h" // for C, Cforall 66 #include "ResolvExpr/typeops.h" // for extractResultType, typesCompat... 67 #include "SynTree/Attribute.h" // for Attribute 68 #include "SynTree/Constant.h" // for Constant 69 #include "SynTree/Declaration.h" // for EnumDecl, StructDecl, UnionDecl 70 #include "SynTree/Expression.h" // for TypeExpr, CompoundLiteralExpr 71 #include "SynTree/Initializer.h" // for ListInit, Initializer, noDesig... 72 #include "SynTree/Mutator.h" // for mutateAll, Mutator 73 #include "SynTree/Statement.h" // for CompoundStmt, DeclStmt, Return... 74 #include "SynTree/Type.h" // for Type, TypeInstType, TraitInstType 75 #include "SynTree/TypeSubstitution.h" // for TypeSubstitution, applySubstit... 76 #include "SynTree/Visitor.h" // for acceptAll, Visitor 75 77 76 78 #define debugPrint( x ) if ( doDebug ) { std::cout << x; } … … 605 607 // a return statement in a void-returning function in C. The expression is treated as if it 606 608 // were cast to void. 607 if ( returnStmt->get_expr() == NULL&& returnVals.size() != 0 ) {609 if ( ! returnStmt->get_expr() && returnVals.size() != 0 ) { 608 610 throw SemanticError( "Non-void function returns no values: " , returnStmt ); 609 611 } … … 836 838 void validateGeneric( Aggr * inst ) { 837 839 std::list< TypeDecl * > * params = inst->get_baseParameters(); 838 if ( params != NULL) {840 if ( params ) { 839 841 std::list< Expression * > & args = inst->get_parameters(); 840 842 … … 937 939 void ArrayLength::previsit( ObjectDecl * objDecl ) { 938 940 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 939 if ( at->get_dimension() != nullptr) return;941 if ( at->get_dimension() ) return; 940 942 if ( ListInit * init = dynamic_cast< ListInit * >( objDecl->get_init() ) ) { 941 943 at->set_dimension( new ConstantExpr( Constant::from_ulong( init->get_initializers().size() ) ) );
Note: See TracChangeset
for help on using the changeset viewer.