Zachary Turner dd3a739d52 [CodeView] Add a random access type visitor.
This adds a visitor that is capable of accessing type
records randomly and caching intermediate results that it
learns about during partial linear scans.  This yields
amortized O(1) access to a type stream even though type
streams cannot normally be indexed.

Differential Revision: https://reviews.llvm.org/D33009

llvm-svn: 302936
2017-05-12 19:18:12 +00:00

62 lines
3.5 KiB
C++

//===- ErrorChecking.h - Helpers for verifying llvm::Errors -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_UNITTESTS_DEBUGINFO_CODEVIEW_ERRORCHECKING_H
#define LLVM_UNITTESTS_DEBUGINFO_CODEVIEW_ERRORCHECKING_H
#define EXPECT_NO_ERROR(Err) \
{ \
auto E = Err; \
EXPECT_FALSE(static_cast<bool>(E)); \
if (E) \
consumeError(std::move(E)); \
}
#define EXPECT_ERROR(Err) \
{ \
auto E = Err; \
EXPECT_TRUE(static_cast<bool>(E)); \
if (E) \
consumeError(std::move(E)); \
}
#define EXPECT_EXPECTED(Exp) \
{ \
auto E = Exp.takeError(); \
EXPECT_FALSE(static_cast<bool>(E)); \
if (E) { \
consumeError(std::move(E)); \
return; \
} \
}
#define EXPECT_EXPECTED_EQ(Val, Exp) \
{ \
auto Result = Exp; \
auto E = Result.takeError(); \
EXPECT_FALSE(static_cast<bool>(E)); \
if (E) { \
consumeError(std::move(E)); \
return; \
} \
EXPECT_EQ(Val, *Result); \
}
#define EXPECT_UNEXPECTED(Exp) \
{ \
auto E = Exp.takeError(); \
EXPECT_TRUE(static_cast<bool>(E)); \
if (E) { \
consumeError(std::move(E)); \
return; \
} \
}
#endif