~ubuntu-branches/ubuntu/feisty/clamav/feisty

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/ADT/VectorExtras.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-02-20 10:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20070220103344-zgcu2psnx9d98fpa
Tags: upstream-0.90
ImportĀ upstreamĀ versionĀ 0.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
21
 
namespace 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
 
///
27
 
template<typename T>
28
 
inline 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