Chromium Code Reviews| Index: src/IceGlobalInits.h |
| diff --git a/src/IceGlobalInits.h b/src/IceGlobalInits.h |
| index 28e814256aeb87772656165602cbfc52d86008b0..e3afa128c2d24fb298b6c6b685cd1ddfcc332db8 100644 |
| --- a/src/IceGlobalInits.h |
| +++ b/src/IceGlobalInits.h |
| @@ -21,6 +21,7 @@ |
| #include "IceDefs.h" |
| #include "IceGlobalContext.h" |
| +#include "IceIntrinsics.h" |
| #include "IceTypes.h" |
| #ifdef __clang__ |
| @@ -156,6 +157,32 @@ public: |
| return verifyLinkageDefault(Ctx); |
| } |
| + /// Validates that type signature of function is correct. Returns true if |
|
Jim Stichnoth
2016/01/14 22:59:08
How about "the type signature" and "the function"?
Karl
2016/01/15 15:33:34
Done.
|
| + /// valid, |
|
Jim Stichnoth
2016/01/14 22:59:08
End sentence with a period, or fill in the missing
Karl
2016/01/15 15:33:34
Done.
|
| + bool validateTypeSignature(const GlobalContext *Ctx) { |
| + bool IsIntrinsic; |
| + if (const Intrinsics::FullIntrinsicInfo *Info = |
| + getIntrinsicInfo(Ctx, IsIntrinsic)) |
| + return validateIntrinsicTypeSignature(Info); |
| + return !IsIntrinsic && validateRegularTypeSignature(); |
| + } |
| + |
| + /// Generates error message describing why validateTypeSignature returns |
|
Jim Stichnoth
2016/01/14 22:59:08
an error message
Karl
2016/01/15 15:33:34
Done.
|
| + /// false. |
| + IceString getTypeSignatureError(const GlobalContext *Ctx); |
| + |
| + /// Returns corresponding PNaCl intrisic information. |
| + const Intrinsics::FullIntrinsicInfo * |
| + getIntrinsicInfo(const GlobalContext *Ctx) const { |
| + bool BadIntrinsic; |
| + return getIntrinsicInfo(Ctx, BadIntrinsic); |
| + } |
| + |
| + /// Same as above, except IsIntrinsic is true if the function is intrinsic |
| + /// (even if not a PNaCl intrinsic). |
| + const Intrinsics::FullIntrinsicInfo * |
| + getIntrinsicInfo(const GlobalContext *Ctx, bool &IsIntrinsic) const; |
|
Jim Stichnoth
2016/01/14 22:59:08
I'm guessing John is going to ask for bool* here.
Karl
2016/01/15 15:33:34
Changed to use bool *.
|
| + |
| private: |
| const Ice::FuncSigType Signature; |
| llvm::CallingConv::ID CallingConv; |
| @@ -173,12 +200,15 @@ private: |
| } |
| bool isIntrinsicName(const GlobalContext *Ctx) const { |
| - if (!hasName()) |
| - return false; |
| - bool BadIntrinsic; |
| - return Ctx->getIntrinsicsInfo().find(getName(), BadIntrinsic) && |
| - !BadIntrinsic; |
| + bool IsIntrinsic; |
| + getIntrinsicInfo(Ctx, IsIntrinsic); |
| + return IsIntrinsic; |
| } |
| + |
| + bool validateRegularTypeSignature() const; |
| + |
| + bool validateIntrinsicTypeSignature( |
| + const Intrinsics::FullIntrinsicInfo *Info) const; |
| }; |
| /// Models a global variable declaration, and its initializers. |