InsightsUtility.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * C++ Insights, copyright (C) by Andreas Fertig
4 * Distributed under an MIT license. See LICENSE for details
5 *
6 ****************************************************************************/
7
8#ifndef INSIGHTS_UTILITY_H
9#define INSIGHTS_UTILITY_H
10
11#include "llvm/ADT/STLExtras.h"
12
13#include <type_traits>
14#include <utility>
15//-----------------------------------------------------------------------------
16
17///! A helper inspired by https://github.com/Microsoft/wil/wiki/Error-handling-helpers
18#define RETURN_IF(cond) \
19 if(cond) { \
20 return; \
21 }
22//-----------------------------------------------------------------------------
23
24#define RETURN_FALSE_IF(cond) \
25 if(cond) { \
26 return false; \
27 }
28//-----------------------------------------------------------------------------
29
30using void_func_ref = llvm::function_ref<void()>;
31//-----------------------------------------------------------------------------
32
33template<typename T, typename... Ts>
34concept same_as_any_of = (std::same_as<T, Ts> or ...);
35
36#endif /* INSIGHTS_UTILITY_H */
llvm::function_ref< void()> void_func_ref