Index: src/IceTypes.h |
diff --git a/src/IceTypes.h b/src/IceTypes.h |
index 6480c2c57bdb8b52326013f5d53559de20c47ff4..cd34ef44c55a52b09b72dad5f335ad8ba1b7eb73 100644 |
--- a/src/IceTypes.h |
+++ b/src/IceTypes.h |
@@ -103,6 +103,40 @@ inline StreamType &operator<<(StreamType &Str, const Type &Ty) { |
return Str; |
} |
+/// Models a type signature for a function. |
Jim Stichnoth
2014/10/05 15:35:47
IceIntrinsics uses something similar to this for i
Karl
2014/10/06 21:15:54
After looking at this some more, it appears that w
|
+class FcnSigType { |
Jim Stichnoth
2014/10/05 15:35:47
A little bikeshedding here... Most of the code bas
Karl
2014/10/06 21:15:54
Renamed to FuncSigType.
|
+ FcnSigType(const FcnSigType&) = delete; |
+ FcnSigType &operator=(const FcnSigType&) = delete; |
+public: |
+ typedef std::vector<Type> ArgListType; |
+ |
+ // Creates a function signature type with the given return type. |
+ // Parameter types should be added using calls to appendArgType. |
+ explicit FcnSigType(Ice::Type ReturnType) : ReturnType(ReturnType) {} |
Jim Stichnoth
2014/10/05 15:35:47
drop the Ice::
Karl
2014/10/06 21:15:54
Done.
|
+ |
+ void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } |
+ |
+ Type getReturnType() const { return ReturnType; } |
+ SizeT getNumArgs() const { return ArgList.size(); } |
+ Type getArgType(SizeT Index) const { |
+ assert(Index < ArgList.size()); |
+ return ArgList[Index]; |
+ } |
+ const ArgListType &getArgList() const { return ArgList; } |
+ void Print(Ostream &Stream) const; |
Jim Stichnoth
2014/10/05 15:35:47
For consistency with the other dump routines:
v
Karl
2014/10/06 21:15:54
Done.
|
+ |
+private: |
+ // The return type. |
+ Type ReturnType; |
+ // The list of parameters. |
+ ArgListType ArgList; |
+}; |
+ |
+inline Ostream &operator<<(Ostream &Stream, const FcnSigType &Sig) { |
+ Sig.Print(Stream); |
+ return Stream; |
+} |
+ |
} // end of namespace Ice |
#endif // SUBZERO_SRC_ICETYPES_H |