1 //===-- Holder Class for manipulating va_lists ------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_SRC_SUPPORT_ARG_LIST_H 10 #define LLVM_LIBC_SRC_SUPPORT_ARG_LIST_H 11 12 #include <stdarg.h> 13 14 namespace __llvm_libc { 15 namespace internal { 16 17 class ArgList { 18 va_list vlist; 19 20 public: ArgList(va_list vlist)21 ArgList(va_list vlist) { va_copy(this->vlist, vlist); } ArgList(ArgList & other)22 ArgList(ArgList &other) { va_copy(this->vlist, other.vlist); } ~ArgList()23 ~ArgList() { va_end(this->vlist); } 24 next_var()25 template <class T> T inline next_var() { return va_arg(vlist, T); } 26 }; 27 28 } // namespace internal 29 } // namespace __llvm_libc 30 31 #endif // LLVM_LIBC_SRC_SUPPORT_ARG_LIST_H 32