mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Make sure that if anyone passes a name by accident for the isSigned
parameter of CreateIntCast then they get an error from the compiler (or from the linker with a non-gcc compiler). Another possibility is to flip the order of the DestTy and isSigned parameters, since you should then get a compiler warning if you try to use a char* for a Type*. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88913 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -78,4 +78,10 @@
|
|||||||
#define NORETURN
|
#define NORETURN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define ERROR_IF_USED __attribute__((error("wrong usage")))
|
||||||
|
#else
|
||||||
|
#define ERROR_IF_USED
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -709,6 +709,9 @@ public:
|
|||||||
return Folder.CreateIntCast(VC, DestTy, isSigned);
|
return Folder.CreateIntCast(VC, DestTy, isSigned);
|
||||||
return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name);
|
return Insert(CastInst::CreateIntegerCast(V, DestTy, isSigned), Name);
|
||||||
}
|
}
|
||||||
|
// Provided to resolve 'CreateIntCast(Ptr, Ptr, "...")', instead of converting
|
||||||
|
// the string to 'bool' for the isSigned parameter.
|
||||||
|
ERROR_IF_USED Value *CreateIntCast(Value *, const Type *, const char *);
|
||||||
Value *CreateFPCast(Value *V, const Type *DestTy, const Twine &Name = "") {
|
Value *CreateFPCast(Value *V, const Type *DestTy, const Twine &Name = "") {
|
||||||
if (V->getType() == DestTy)
|
if (V->getType() == DestTy)
|
||||||
return V;
|
return V;
|
||||||
|
Reference in New Issue
Block a user