| [59cf83b] | 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
|---|
| 3 | //
|
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
|---|
| 5 | // file "LICENCE" distributed with Cforall.
|
|---|
| 6 | //
|
|---|
| 7 | // ResolvMode.h --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Aaron B. Moss
|
|---|
| 10 | // Created On : Mon Jun 11 13:28:00 2018
|
|---|
| 11 | // Last Modified By : Aaron B. Moss
|
|---|
| [6d6e829] | 12 | // Last Modified On : Fri Oct 05 13:46:00 2018
|
|---|
| 13 | // Update Count : 2
|
|---|
| [59cf83b] | 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #pragma once
|
|---|
| 17 |
|
|---|
| 18 | namespace ResolvExpr {
|
|---|
| 19 | /// Flag set for resolution
|
|---|
| 20 | struct ResolvMode {
|
|---|
| 21 | const bool adjust; ///< Adjust array and function types to pointer types? [false]
|
|---|
| 22 | const bool prune; ///< Prune alternatives to min-cost per return type? [true]
|
|---|
| 23 | const bool failFast; ///< Fail on no resulting alternatives? [true]
|
|---|
| 24 |
|
|---|
| [1389810] | 25 | constexpr ResolvMode(bool a, bool p, bool ff)
|
|---|
| 26 | : adjust(a), prune(p), failFast(ff) {}
|
|---|
| [59cf83b] | 27 |
|
|---|
| 28 | /// Default settings
|
|---|
| [1389810] | 29 | constexpr ResolvMode() : adjust(false), prune(true), failFast(true) {}
|
|---|
| [59cf83b] | 30 |
|
|---|
| 31 | /// With adjust flag set; turns array and function types into equivalent pointers
|
|---|
| [1389810] | 32 | static constexpr ResolvMode withAdjustment() { return { true, true, true }; }
|
|---|
| [59cf83b] | 33 |
|
|---|
| 34 | /// With adjust flag set but prune unset; pruning ensures there is at least one alternative
|
|---|
| 35 | /// per result type
|
|---|
| [1389810] | 36 | static constexpr ResolvMode withoutPrune() { return { true, false, true }; }
|
|---|
| [59cf83b] | 37 |
|
|---|
| 38 | /// With adjust and prune flags set but failFast unset; failFast ensures there is at least
|
|---|
| 39 | /// one resulting alternative
|
|---|
| [1389810] | 40 | static constexpr ResolvMode withoutFailFast() { return { true, true, false }; }
|
|---|
| [6d6e829] | 41 |
|
|---|
| [396037d] | 42 | /// The same mode, but with satisfyAssns turned on; for top-level calls
|
|---|
| [1389810] | 43 | ResolvMode atTopLevel() const { return { adjust, true, failFast }; }
|
|---|
| [59cf83b] | 44 | };
|
|---|
| 45 | } // namespace ResolvExpr
|
|---|
| 46 |
|
|---|
| 47 | // Local Variables: //
|
|---|
| 48 | // tab-width: 4 //
|
|---|
| 49 | // mode: c++ //
|
|---|
| 50 | // compile-command: "make install" //
|
|---|
| 51 | // End: //
|
|---|