Further improvements to error reporting with function types.

Issue #219.
This commit is contained in:
Matt Pharr
2012-04-03 05:55:50 -07:00
parent 920cf63201
commit eb85da81e1
3 changed files with 14 additions and 15 deletions

View File

@@ -2466,18 +2466,7 @@ FunctionType::GetAsNonConstType() const {
std::string
FunctionType::GetString() const {
std::string ret;
if (isTask) ret += "task ";
if (isSafe) ret += "/*safe*/ ";
if (costOverride > 0) {
char buf[32];
sprintf(buf, "/*cost=%d*/ ", costOverride);
ret += buf;
}
if (returnType != NULL)
ret += returnType->GetString();
else
ret += "/* ERROR */";
std::string ret = GetReturnTypeString();
ret += "(";
for (unsigned int i = 0; i < paramTypes.size(); ++i) {
if (paramTypes[i] == NULL)
@@ -2554,6 +2543,9 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
const std::string
FunctionType::GetReturnTypeString() const {
if (returnType == NULL)
return "/* ERROR */";
std::string ret;
if (isTask)
ret += "task ";
@@ -2561,6 +2553,13 @@ FunctionType::GetReturnTypeString() const {
ret += "export ";
if (isExternC)
ret += "extern \"C\" ";
if (isSafe)
ret += "/*safe*/ ";
if (costOverride > 0) {
char buf[32];
sprintf(buf, "/*cost=%d*/ ", costOverride);
ret += buf;
}
return ret + returnType->GetString();
}