[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]
|
---|
[396037d] | 24 | const bool satisfyAssns; ///< Satisfy assertions? [false]
|
---|
[59cf83b] | 25 |
|
---|
| 26 | private:
|
---|
[396037d] | 27 | constexpr ResolvMode(bool a, bool p, bool ff, bool sa)
|
---|
| 28 | : adjust(a), prune(p), failFast(ff), satisfyAssns(sa) {}
|
---|
[59cf83b] | 29 |
|
---|
| 30 | public:
|
---|
| 31 | /// Default settings
|
---|
[396037d] | 32 | constexpr ResolvMode() : adjust(false), prune(true), failFast(true), satisfyAssns(false) {}
|
---|
[59cf83b] | 33 |
|
---|
| 34 | /// With adjust flag set; turns array and function types into equivalent pointers
|
---|
| 35 | static constexpr ResolvMode withAdjustment() { return { true, true, true, false }; }
|
---|
| 36 |
|
---|
| 37 | /// With adjust flag set but prune unset; pruning ensures there is at least one alternative
|
---|
| 38 | /// per result type
|
---|
| 39 | static constexpr ResolvMode withoutPrune() { return { true, false, true, false }; }
|
---|
| 40 |
|
---|
| 41 | /// With adjust and prune flags set but failFast unset; failFast ensures there is at least
|
---|
| 42 | /// one resulting alternative
|
---|
| 43 | static constexpr ResolvMode withoutFailFast() { return { true, true, false, false }; }
|
---|
[6d6e829] | 44 |
|
---|
[396037d] | 45 | /// The same mode, but with satisfyAssns turned on; for top-level calls
|
---|
[6d6e829] | 46 | ResolvMode atTopLevel() const { return { adjust, prune, failFast, true }; }
|
---|
[59cf83b] | 47 | };
|
---|
| 48 | } // namespace ResolvExpr
|
---|
| 49 |
|
---|
| 50 | // Local Variables: //
|
---|
| 51 | // tab-width: 4 //
|
---|
| 52 | // mode: c++ //
|
---|
| 53 | // compile-command: "make install" //
|
---|
| 54 | // End: //
|
---|