diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index da31f986288..cce652f9261 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -78,4 +78,10 @@ #define NORETURN #endif +#ifdef __GNUC__ +#define ERROR_IF_USED __attribute__((error("wrong usage"))) +#else +#define ERROR_IF_USED +#endif + #endif diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 05c3c569aa1..1d3c08c6375 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -709,6 +709,9 @@ public: return Folder.CreateIntCast(VC, DestTy, isSigned); 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 = "") { if (V->getType() == DestTy) return V;