Add method to return the type this type will be promoted to if it is
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Sat, 23 Apr 2005 00:11:21 +0000 (00:11 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Sat, 23 Apr 2005 00:11:21 +0000 (00:11 +0000)
passed through a variable argument function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21462 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Type.h

index f832427934f0c859a01e8dcf8ede09b65dbccf79..443a6bcdc30cfd1de4baacc5e90982d646d4a50f 100644 (file)
@@ -236,6 +236,20 @@ public:
     return getForwardedTypeInternal();
   }
 
+  /// getVAArgsPromotedType - Return the type an argument of this type
+  /// will be promoted to if passed through a variable argument
+  /// function.
+  const Type *getVAArgsPromotedType() const {
+    if (ID == BoolTyID || ID == UByteTyID || ID == UShortTyID)
+      return Type::UIntTy;
+    else if (ID == SByteTyID || ID == ShortTyID)
+      return Type::IntTy;
+    else if (ID == FloatTyID)
+      return Type::DoubleTy;
+    else
+      return this;
+  }
+
   //===--------------------------------------------------------------------===//
   // Type Iteration support
   //