[llvm-commits] [llvm] r89067 - in /llvm/trunk/include/llvm/Support: Compiler.h IRBuilder.h

Duncan Sands baldrick at free.fr
Tue Nov 17 00:34:52 PST 2009


Author: baldrick
Date: Tue Nov 17 02:34:52 2009
New Revision: 89067

URL: http://llvm.org/viewvc/llvm-project?rev=89067&view=rev
Log:
Following a suggestion of Daniel Dunbar, stop people passing the name
as the isSigned bool to CreateIntCast by having this resolve to a call
to a private method, rather than by using a gcc attribute.

Modified:
    llvm/trunk/include/llvm/Support/Compiler.h
    llvm/trunk/include/llvm/Support/IRBuilder.h

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=89067&r1=89066&r2=89067&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Tue Nov 17 02:34:52 2009
@@ -78,12 +78,4 @@
 #define NORETURN
 #endif
 
-#if defined(__GNUC__) && ((__GNUC__ > 4)||(__GNUC__ == 4 && __GNUC_MINOR__ > 2))
-#define ERROR_IF_USED __attribute__((error("wrong usage")))
-#elif defined(__APPLE__)
-#define ERROR_IF_USED __attribute__((unavailable))
-#else
-#define ERROR_IF_USED
-#endif
-
 #endif

Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=89067&r1=89066&r2=89067&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Nov 17 02:34:52 2009
@@ -709,9 +709,11 @@
       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 *);
+private:
+  // Provided to resolve 'CreateIntCast(Ptr, Ptr, "...")', giving a compile time
+  // error, instead of converting the string to bool for the isSigned parameter.
+  Value *CreateIntCast(Value *, const Type *, const char *); // DO NOT IMPLEMENT
+public:
   Value *CreateFPCast(Value *V, const Type *DestTy, const Twine &Name = "") {
     if (V->getType() == DestTy)
       return V;





More information about the llvm-commits mailing list