1//===-- llvm/ADT/VectorExtras.h - Helpers for std::vector -------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file contains helper functions which are useful for working with the 11// std::vector class. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef LLVM_ADT_VECTOREXTRAS_H 16#define LLVM_ADT_VECTOREXTRAS_H 17 18#include <cstdarg> 19#include <vector> 20 21namespace llvm { 22 23/// make_vector - Helper function which is useful for building temporary vectors 24/// to pass into type construction of CallInst ctors. This turns a null 25/// terminated list of pointers (or other value types) into a real live vector. 26/// 27template<typename T> 28inline std::vector<T> make_vector(T A, ...) { 29 va_list Args; 30 va_start(Args, A); 31 std::vector<T> Result; 32 Result.push_back(A); 33 while (T Val = va_arg(Args, T)) 34 Result.push_back(Val); 35 va_end(Args); 36 return Result; 37} 38 39} // End llvm namespace 40 41#endif 42