Only allow exact matches for function overload resolution for builtins.

The intent is that the code in stdlib.ispc that is calling out to the built-ins
  should match argument types exactly (using explicit casts as needed), just
  for maximal clarity/safety.
This commit is contained in:
Matt Pharr
2011-09-28 17:20:31 -07:00
parent 6d39d5fc3e
commit 32a0a30cf5
5 changed files with 96 additions and 78 deletions

7
expr.h
View File

@@ -265,7 +265,7 @@ public:
bool isLaunch;
private:
void resolveFunctionOverloads();
void resolveFunctionOverloads(bool exactMatchOnly);
bool tryResolve(bool (*matchFunc)(Expr *, const Type *));
};
@@ -567,7 +567,7 @@ private:
*/
class FunctionSymbolExpr : public Expr {
public:
FunctionSymbolExpr(std::vector<Symbol *> *candidateFunctions,
FunctionSymbolExpr(const char *name, std::vector<Symbol *> *candidateFunctions,
SourcePos pos);
llvm::Value *GetValue(FunctionEmitContext *ctx) const;
@@ -581,6 +581,9 @@ public:
private:
friend class FunctionCallExpr;
/** Name of the function that is being called. */
std::string name;
/** All of the functions with the name given in the function call;
there may be more then one, in which case we need to resolve which
overload is the best match. */