Commit Graph

10 Commits

Author SHA1 Message Date
Robert Widmann
3d09a00a0a CacheKind -> RequestFlags 2020-03-31 16:16:53 -07:00
Robert Widmann
987cd55f50 [NFC] Drop llvm::Expected from Evaluation Points
A request is intended to be a pure function of its inputs. That function could, in theory, fail. In practice, there were basically no requests taking advantage of this ability - the few that were using it to explicitly detect cycles can just return reasonable defaults instead of forwarding the error on up the stack.

This is because cycles are checked by *the Evaluator*, and are unwound by the Evaluator.

Therefore, restore the idea that the evaluate functions are themselves pure, but keep the idea that *evaluation* of those requests may fail. This model enables the best of both worlds: we not only keep the evaluator flexible enough to handle future use cases like cancellation and diagnostic invalidation, but also request-based dependencies using the values computed at the evaluation points. These aforementioned use cases would use the llvm::Expected interface and the regular evaluation-point interface respectively.
2020-03-26 23:08:02 -07:00
Robert Widmann
087e2f2746 [Evaluator Ergonomics] Add location information options to the requests 2019-09-06 11:16:17 -07:00
Robert Widmann
7a51cfcb87 [Evaluator Ergonomics] Add Request Signatures
Also add their caching kinds.  This information will be used to remove
the need to define classes at all.
2019-09-05 13:15:02 -07:00
Robert Widmann
a19a70e5c9 Switch all request infrastructure to SWIFT_REQUEST
Formally define the Zones in the TypeID header.  This is not its final
resting place.
2019-08-27 17:38:14 -07:00
Doug Gregor
39d4e6b41d [Request-evaluator] Remove extraneous diagnoseCycle/noteCycleStep impls.
All of these can use the default implementations now.
2019-07-10 17:26:39 -07:00
Doug Gregor
46a220b9a1 [Evaluator] Simplify template signature for SimpleRequest.
Encode the input and output parameters for a SimpleRequest instance in a
function type and move the CacheKind to the end, making it easier to
sort out inputs from outputs:

```
  class DefaultTypeRequest
    : public SimpleRequest<DefaultTypeRequest,
                           Type(KnownProtocolKind, const DeclContext *),
                           CacheKind::SeparatelyCached>
```
2019-07-10 14:54:22 -07:00
Saleem Abdulrasool
05d2bb9fd2 AST: friend SimpleRequest without type specifier
When building with Visual Studio, the following error is identified:

  'SimpleRequest': non-class template has already been declared as a class template
  note: see declaration of 'SimpleRequest'

Change the friend declarations to friend the type without the `class` specifier.
2018-09-12 11:35:34 -07:00
Harlan Haskins
5a6985f39e Remove SimpleRequest::breakCycle
This patch removes the need for Request objects to provide a default
cycle-breaking value, instead opting to return llvm::Expected so clients
must handle a cycle failure explicitly.

Currently, all clients do the 'default' behavior, but this opens the
possibility for future requests to handle failures explicitly.
2018-08-15 11:01:12 -07:00
Graydon Hoare
465ca073f8 [Sema] Move AccessLevel calculation to AST-level requests. 2018-07-04 16:56:26 -07:00