IntrinsicTable: Fix a number of TODOs

And add tests for IntrinsicTable.

Drop all the type unwrapping - be precise:
* Display the actual argument types in the signature mismatch message
* Only dereference pointer arguments if the parameter does not expect a pointer

Correctly match access control on storage types

Note that I was mistaken in tint:486 - the TypeDeterminer is resolving identifiers to variables correctly as pointer types. The confustion here was probably due to all the UnwrapAll() calls, which have now all gone.

Fixed: tint:486
Change-Id: I239eabd1fedfc082566c4af616ccfc58786cae25
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41280
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-02-10 21:34:25 +00:00
committed by Commit Bot service account
parent 2101c35f3b
commit faca02d438
7 changed files with 650 additions and 53 deletions

View File

@@ -56,6 +56,13 @@ struct Parameter {
Usage const usage = Usage::kNone;
};
std::ostream& operator<<(std::ostream& out, Parameter parameter);
/// Comparison operator for Parameters
static inline bool operator==(const Parameter& a, const Parameter& b) {
return a.type == b.type && a.usage == b.usage;
}
/// @returns a string representation of the given parameter usage.
const char* str(Parameter::Usage usage);

View File

@@ -14,6 +14,7 @@
#include "src/semantic/call_target.h"
#include "src/symbol_table.h"
#include "src/type/type.h"
TINT_INSTANTIATE_CLASS_ID(tint::semantic::CallTarget);
@@ -65,5 +66,12 @@ const char* str(Parameter::Usage usage) {
return "<unknown>";
}
}
std::ostream& operator<<(std::ostream& out, Parameter parameter) {
out << "[type: " << parameter.type->FriendlyName(SymbolTable{})
<< ", usage: " << str(parameter.usage) << "]";
return out;
}
} // namespace semantic
} // namespace tint