| 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
|---|
| 3 | //
|
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
|---|
| 5 | // file "LICENCE" distributed with Cforall.
|
|---|
| 6 | //
|
|---|
| 7 | // RemoveInit.h --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Rob Schluntz
|
|---|
| 10 | // Created On : Fri May 13 11:26:36 2016
|
|---|
| 11 | // Last Modified By : Rob Schluntz
|
|---|
| 12 | // Last Modified On : Fri May 13 11:35:36 2016
|
|---|
| 13 | // Update Count : 3
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #ifndef INIT_TWEAK_H
|
|---|
| 17 | #define INIT_TWEAK_H
|
|---|
| 18 |
|
|---|
| 19 | #include <string>
|
|---|
| 20 | #include <list>
|
|---|
| 21 |
|
|---|
| 22 | #include "SynTree/SynTree.h"
|
|---|
| 23 | #include "SynTree/Declaration.h"
|
|---|
| 24 | #include "SynTree/Mutator.h"
|
|---|
| 25 |
|
|---|
| 26 | // helper functions for initialization
|
|---|
| 27 | namespace InitTweak {
|
|---|
| 28 | /// transform Initializer into an argument list that can be passed to a call expression
|
|---|
| 29 | std::list< Expression * > makeInitList( Initializer * init );
|
|---|
| 30 |
|
|---|
| 31 | /// True if the resolver should try to construct objDecl
|
|---|
| 32 | bool tryConstruct( ObjectDecl * objDecl );
|
|---|
| 33 |
|
|---|
| 34 | /// True if the Initializer contains designations
|
|---|
| 35 | bool isDesignated( Initializer * init );
|
|---|
| 36 |
|
|---|
| 37 | /// True if stmt is a call statement where the function called is intrinsic and takes one parameter.
|
|---|
| 38 | /// Intended to be used for default ctor/dtor calls, but might have use elsewhere.
|
|---|
| 39 | /// Currently has assertions that make it less than fully general.
|
|---|
| 40 | bool isInstrinsicSingleArgCallStmt( Statement * expr );
|
|---|
| 41 |
|
|---|
| 42 | /// get the Ctor/Dtor call expression from a Statement that looks like a generated ctor/dtor call
|
|---|
| 43 | Expression * getCtorDtorCall( Statement * stmt );
|
|---|
| 44 |
|
|---|
| 45 | /// returns the name of the function being called
|
|---|
| 46 | std::string getFunctionName( Expression * expr );
|
|---|
| 47 |
|
|---|
| 48 | /// returns the argument to a call expression in position N indexed from 0
|
|---|
| 49 | Expression *& getCallArg( Expression * callExpr, unsigned int pos );
|
|---|
| 50 |
|
|---|
| 51 | /// returns the base type of a PointerType or ArrayType, else returns NULL
|
|---|
| 52 | Type * getPointerBase( Type * );
|
|---|
| 53 |
|
|---|
| 54 | /// returns the argument if it is a PointerType or ArrayType, else returns NULL
|
|---|
| 55 | Type * isPointerType( Type * );
|
|---|
| 56 | } // namespace
|
|---|
| 57 |
|
|---|
| 58 | #endif // INITTWEAK_GENINIT_H
|
|---|
| 59 |
|
|---|
| 60 | // Local Variables: //
|
|---|
| 61 | // tab-width: 4 //
|
|---|
| 62 | // mode: c++ //
|
|---|
| 63 | // compile-command: "make install" //
|
|---|
| 64 | // End: //
|
|---|