Changeset ffec1bf for src/Validate
- Timestamp:
- Jul 25, 2022, 2:23:28 PM (4 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 4c48be0, 5cf1228, def751f
- Parents:
- 9e23b446 (diff), 1f950c3b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/Validate
- Files:
-
- 12 added
- 14 edited
-
Autogen.cpp (modified) (4 diffs)
-
Autogen.hpp (modified) (1 diff)
-
CompoundLiteral.hpp (modified) (1 diff)
-
EliminateTypedef.cpp (modified) (3 diffs)
-
EnumAndPointerDecay.cpp (added)
-
EnumAndPointerDecay.hpp (added)
-
FindSpecialDecls.h (modified) (2 diffs)
-
FixQualifiedTypes.cpp (modified) (2 diffs)
-
FixQualifiedTypes.hpp (modified) (2 diffs)
-
FixReturnTypes.cpp (added)
-
FixReturnTypes.hpp (added)
-
ForallPointerDecay.hpp (modified) (1 diff)
-
GenericParameter.cpp (modified) (1 diff)
-
GenericParameter.hpp (modified) (2 diffs)
-
HoistStruct.hpp (modified) (1 diff)
-
HoistTypeDecls.cpp (added)
-
HoistTypeDecls.hpp (added)
-
LabelAddressFixer.cpp (modified) (1 diff)
-
LabelAddressFixer.hpp (modified) (2 diffs)
-
LinkReferenceToTypes.cpp (added)
-
LinkReferenceToTypes.hpp (added)
-
ReplaceTypedef.cpp (added)
-
ReplaceTypedef.hpp (added)
-
VerifyCtorDtorAssign.cpp (added)
-
VerifyCtorDtorAssign.hpp (added)
-
module.mk (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/Autogen.cpp
r9e23b446 rffec1bf 28 28 #include "AST/DeclReplacer.hpp" 29 29 #include "AST/Expr.hpp" 30 #include "AST/Inspect.hpp" 30 31 #include "AST/Pass.hpp" 31 32 #include "AST/Stmt.hpp" … … 121 122 122 123 // Built-ins do not use autogeneration. 123 bool shouldAutogen() const final { return !decl->linkage.is_builtin ; }124 bool shouldAutogen() const final { return !decl->linkage.is_builtin && !structHasFlexibleArray(decl); } 124 125 private: 125 126 void genFuncBody( ast::FunctionDecl * decl ) final; … … 183 184 { 184 185 // TODO: These functions are somewhere between instrinsic and autogen, 185 // could possibly use a new linkage type. For now we just make them 186 // intrinsic to code-gen them as C assignments. 187 proto_linkage = ast::Linkage::Intrinsic; 186 // could possibly use a new linkage type. For now we just make the 187 // basic ones intrinsic to code-gen them as C assignments. 188 const auto & real_type = decl->base; 189 const auto & basic = real_type.as<ast::BasicType>(); 190 if(!real_type || (basic && basic->isInteger())) proto_linkage = ast::Linkage::Intrinsic; 188 191 } 189 192 … … 402 405 auto retval = srcParam(); 403 406 retval->name = "_ret"; 404 // xxx - Adding this unused attribute can slience unused variable warning405 // However, some code might not be compiled as expected406 // Temporarily disabled407 // retval->attributes.push_back(new ast::Attribute("unused"));408 407 return genProto( "?=?", { dstParam(), srcParam() }, { retval } ); 409 408 } -
src/Validate/Autogen.hpp
r9e23b446 rffec1bf 22 22 namespace Validate { 23 23 24 /// Generate routines for all data types in the translation unit. 25 /// A lot of passes have to happen either before or after this pass. 24 26 void autogenerateRoutines( ast::TranslationUnit & translationUnit ); 25 27 -
src/Validate/CompoundLiteral.hpp
r9e23b446 rffec1bf 23 23 24 24 /// Use variables to implement compound literals. 25 /// Must happen after auto-gen routines are added. 25 26 void handleCompoundLiterals( ast::TranslationUnit & translationUnit ); 26 27 -
src/Validate/EliminateTypedef.cpp
r9e23b446 rffec1bf 10 10 // Created On : Wed Apr 20 16:37:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Apr 25 14:26:00 202213 // Update Count : 012 // Last Modified On : Mon Jul 11 16:30:00 2022 13 // Update Count : 1 14 14 // 15 15 … … 28 28 29 29 struct EliminateTypedefCore { 30 // Remove typedefs from inside aggregates. 30 31 ast::StructDecl const * previsit( ast::StructDecl const * decl ); 31 32 ast::UnionDecl const * previsit( ast::UnionDecl const * decl ); 33 // Remove typedefs from statement lists. 32 34 ast::CompoundStmt const * previsit( ast::CompoundStmt const * stmt ); 35 // Remove typedefs from control structure initializers. 36 ast::IfStmt const * previsit( ast::IfStmt const * stmt ); 37 ast::ForStmt const * previsit( ast::ForStmt const * stmt ); 38 ast::WhileDoStmt const * previsit( ast::WhileDoStmt const * stmt ); 33 39 }; 34 40 … … 63 69 } 64 70 71 ast::IfStmt const * EliminateTypedefCore::previsit( ast::IfStmt const * stmt ) { 72 return field_erase_if( stmt, &ast::IfStmt::inits, isTypedefStmt ); 73 } 74 75 ast::ForStmt const * EliminateTypedefCore::previsit( ast::ForStmt const * stmt ) { 76 return field_erase_if( stmt, &ast::ForStmt::inits, isTypedefStmt ); 77 } 78 79 ast::WhileDoStmt const * EliminateTypedefCore::previsit( ast::WhileDoStmt const * stmt ) { 80 return field_erase_if( stmt, &ast::WhileDoStmt::inits, isTypedefStmt ); 81 } 82 65 83 } // namespace 66 84 -
src/Validate/FindSpecialDecls.h
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FindSpecialDeclarations.h -- 7 // FindSpecialDeclarations.h -- Find special declarations used in the compiler. 8 8 // 9 9 // Author : Rob Schluntz … … 43 43 void findSpecialDecls( std::list< Declaration * > & translationUnit ); 44 44 45 /// find and remember some of the special declarations that are useful for45 /// Find and remember some of the special declarations that are useful for 46 46 /// generating code, so that they do not have to be discovered multiple times. 47 47 void findGlobalDecls( ast::TranslationUnit & translationUnit ); -
src/Validate/FixQualifiedTypes.cpp
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixQualifiedTypes.cpp -- 7 // FixQualifiedTypes.cpp -- Replace the qualified type with a direct type. 8 8 // 9 9 // Author : Andrew Beach … … 76 76 ret->qualifiers = type->qualifiers; 77 77 ast::TypeSubstitution sub( aggr->params, instp->params ); 78 // = parent->genericSubstitution();79 78 auto result = sub.apply(ret); 80 79 return result.node.release(); -
src/Validate/FixQualifiedTypes.hpp
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixQualifiedTypes.hpp -- 7 // FixQualifiedTypes.hpp -- Replace the qualified type with a direct type. 8 8 // 9 9 // Author : Andrew Beach … … 22 22 namespace Validate { 23 23 24 /// Replaces qualified types with an unqualified NamedTypeDecl. 25 /// Must happen after Link References To Types, 26 /// because aggregate members are accessed. 24 27 void fixQualifiedTypes( ast::TranslationUnit & translationUnit ); 25 28 -
src/Validate/ForallPointerDecay.hpp
r9e23b446 rffec1bf 29 29 /// Also checks that operator names are used properly on functions and 30 30 /// assigns unique IDs. This is a "legacy" pass. 31 /// Must be after implement concurrent keywords; because uniqueIds must be 32 /// set on declaration before resolution. 33 /// Must happen before auto-gen routines are added. 31 34 void decayForallPointers( ast::TranslationUnit & transUnit ); 32 35 -
src/Validate/GenericParameter.cpp
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // GenericParameter.hpp -- 7 // GenericParameter.hpp -- Generic parameter related passes. 8 8 // 9 9 // Author : Andrew Beach -
src/Validate/GenericParameter.hpp
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // GenericParameter.hpp -- 7 // GenericParameter.hpp -- Generic parameter related passes. 8 8 // 9 9 // Author : Andrew Beach … … 23 23 24 24 /// Perform substutions for generic parameters and fill in defaults. 25 /// Check as early as possible, but it can't happen before Link References to 26 /// Types and observed failing when attempted before eliminate typedef. 25 27 void fillGenericParameters( ast::TranslationUnit & translationUnit ); 26 28 -
src/Validate/HoistStruct.hpp
r9e23b446 rffec1bf 22 22 namespace Validate { 23 23 24 /// Flattens nested type declarations. 24 /// Flattens nested type declarations. (Run right after Fix Qualified Types.) 25 25 void hoistStruct( ast::TranslationUnit & translationUnit ); 26 26 -
src/Validate/LabelAddressFixer.cpp
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelAddressFixer.cpp -- 7 // LabelAddressFixer.cpp -- Create label address expressions. 8 8 // 9 9 // Author : Andrew Beach -
src/Validate/LabelAddressFixer.hpp
r9e23b446 rffec1bf 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelAddressFixer.hpp -- 7 // LabelAddressFixer.hpp -- Create label address expressions. 8 8 // 9 9 // Author : Andrew Beach … … 20 20 namespace Validate { 21 21 22 /// Label addresses are not actually created in the parser, this pass finds 23 /// the patterns that represent the label address expression. 22 24 void fixLabelAddresses( ast::TranslationUnit & translationUnit ); 23 25 -
src/Validate/module.mk
r9e23b446 rffec1bf 26 26 Validate/EliminateTypedef.cpp \ 27 27 Validate/EliminateTypedef.hpp \ 28 Validate/EnumAndPointerDecay.cpp \ 29 Validate/EnumAndPointerDecay.hpp \ 28 30 Validate/FindSpecialDeclsNew.cpp \ 29 31 Validate/FixQualifiedTypes.cpp \ 30 32 Validate/FixQualifiedTypes.hpp \ 33 Validate/FixReturnTypes.cpp \ 34 Validate/FixReturnTypes.hpp \ 31 35 Validate/ForallPointerDecay.cpp \ 32 36 Validate/ForallPointerDecay.hpp \ … … 37 41 Validate/HoistStruct.cpp \ 38 42 Validate/HoistStruct.hpp \ 43 Validate/HoistTypeDecls.cpp \ 44 Validate/HoistTypeDecls.hpp \ 39 45 Validate/InitializerLength.cpp \ 40 46 Validate/InitializerLength.hpp \ 41 47 Validate/LabelAddressFixer.cpp \ 42 48 Validate/LabelAddressFixer.hpp \ 49 Validate/LinkReferenceToTypes.cpp \ 50 Validate/LinkReferenceToTypes.hpp \ 43 51 Validate/NoIdSymbolTable.hpp \ 52 Validate/ReplaceTypedef.cpp \ 53 Validate/ReplaceTypedef.hpp \ 44 54 Validate/ReturnCheck.cpp \ 45 Validate/ReturnCheck.hpp 55 Validate/ReturnCheck.hpp \ 56 Validate/VerifyCtorDtorAssign.cpp \ 57 Validate/VerifyCtorDtorAssign.hpp 46 58 47 59 SRCDEMANGLE += $(SRC_VALIDATE)
Note:
See TracChangeset
for help on using the changeset viewer.