From 412aeda0468413fb1b575460f20bfefd2d13b483 Mon Sep 17 00:00:00 2001 From: kai Date: Sun, 12 Jan 2014 18:03:48 +0100 Subject: [PATCH] Remove gen/utils.h ArrayIter<> is replaced by Array<>::iterator or other patterns. The class is now unused and can be removed. --- gen/utils.h | 86 ----------------------------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 gen/utils.h diff --git a/gen/utils.h b/gen/utils.h deleted file mode 100644 index 8d0fc61e..00000000 --- a/gen/utils.h +++ /dev/null @@ -1,86 +0,0 @@ -//===-- gen/utils.h - Utilities for handling frontend types -----*- C++ -*-===// -// -// LDC – the LLVM D compiler -// -// This file is distributed under the BSD-style LDC license. See the LICENSE -// file for details. -// -//===----------------------------------------------------------------------===// -// -// Some utilities for handling front-end types in a more C++-like fashion. -// -//===----------------------------------------------------------------------===// - -#ifndef LDC_GEN_UTILS_H -#define LDC_GEN_UTILS_H - -#include "root.h" - -/// Very simple templated iterator for DMD ArrayS. -template -struct ArrayIter -{ - Array* array; - size_t index; - - ArrayIter(Array& arr, size_t idx = 0) - : array(&arr), index(idx) - { } - ArrayIter(Array* arr, size_t idx = 0) - : array(arr), index(idx) - { assert(arr && "null array"); } - - ArrayIter& operator=(const Array& arr) - { - array = const_cast*>(&arr); - index = 0; - return *this; - } - ArrayIter& operator=(const Array* arr) - { - assert(arr && "null array"); - array = const_cast*>(arr); - index = 0; - return *this; - } - - bool done() - { - return index >= array->dim; - } - bool more() - { - return index < array->dim; - } - - C* get() { - return (*array)[index]; - } - C* operator->() { - return get(); - } - C* operator*() { - return get(); - } - - void next() - { - ++index; - } - - bool operator==(const ArrayIter& other) { - return &array->data[index] == &other.array->data[other.index]; - } -}; - -// From dsymbol.h / declaration.h -class Dsymbol; -class FuncDeclaration; -class VarDeclaration; - -// some aliases -typedef ArrayIter DsymbolIter; -typedef ArrayIter FuncDeclarationIter; -typedef ArrayIter VarDeclarationIter; - -#endif