[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 | // |
---|
[4a89b52] | 7 | // ResolveMode.hpp -- |
---|
[59cf83b] | 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 { |
---|
[2908f08] | 19 | |
---|
| 20 | /// Flag set for resolution |
---|
[4a89b52] | 21 | struct ResolveMode { |
---|
[2908f08] | 22 | const bool adjust; ///< Adjust array and function types to pointer types? [false] |
---|
| 23 | const bool prune; ///< Prune alternatives to min-cost per return type? [true] |
---|
| 24 | const bool failFast; ///< Fail on no resulting alternatives? [true] |
---|
| 25 | |
---|
[4a89b52] | 26 | constexpr ResolveMode(bool a, bool p, bool ff) |
---|
[2908f08] | 27 | : adjust(a), prune(p), failFast(ff) {} |
---|
| 28 | |
---|
| 29 | /// Default settings |
---|
[4a89b52] | 30 | constexpr ResolveMode() : adjust(false), prune(true), failFast(true) {} |
---|
[2908f08] | 31 | |
---|
| 32 | /// With adjust flag set; turns array and function types into equivalent pointers |
---|
[4a89b52] | 33 | static constexpr ResolveMode withAdjustment() { return { true, true, true }; } |
---|
[2908f08] | 34 | |
---|
| 35 | /// With adjust flag set but prune unset; pruning ensures there is at least one alternative |
---|
| 36 | /// per result type |
---|
[4a89b52] | 37 | static constexpr ResolveMode withoutPrune() { return { true, false, true }; } |
---|
[2908f08] | 38 | |
---|
| 39 | /// With adjust and prune flags set but failFast unset; failFast ensures there is at least |
---|
| 40 | /// one resulting alternative |
---|
[4a89b52] | 41 | static constexpr ResolveMode withoutFailFast() { return { true, true, false }; } |
---|
[2908f08] | 42 | |
---|
| 43 | /// The same mode, but with satisfyAssns turned on; for top-level calls |
---|
[4a89b52] | 44 | ResolveMode atTopLevel() const { return { adjust, true, failFast }; } |
---|
[2908f08] | 45 | }; |
---|
| 46 | |
---|
[59cf83b] | 47 | } // namespace ResolvExpr |
---|
| 48 | |
---|
| 49 | // Local Variables: // |
---|
| 50 | // tab-width: 4 // |
---|
| 51 | // mode: c++ // |
---|
| 52 | // compile-command: "make install" // |
---|
[2908f08] | 53 | // End: // |
---|