diagnostic duplicates no longer raised

This commit is contained in:
Jack Andersen 2015-06-19 08:25:08 -10:00
parent fd3db3e1db
commit 242a06915b
3 changed files with 145 additions and 93 deletions

View File

@ -1,7 +1,7 @@
# PKGBUILD for libAthena
_pkgname=libathena
pkgname=$_pkgname-git
pkgver=1.1.0.34.g7b1b027
pkgver=1.1.0.35.gfd3db3e
pkgrel=1
pkgdesc="Basic cross platform IO library"
arch=('i686' 'x86_64')

View File

@ -1,7 +1,7 @@
# PKGBUILD for atdna
_pkgname=atdna
pkgname=$_pkgname-git
pkgver=1.1.0.32.g1aa3a70
pkgver=1.1.0.35.gfd3db3e
pkgrel=1
pkgdesc="Companion DNA utility for libAthena"
arch=('i686' 'x86_64')

View File

@ -278,10 +278,13 @@ public:
const clang::Expr* defArg = nttParm->getDefaultArgument();
endianExpr = defArg;
if (!defArg->isIntegerConstantExpr(endian, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(defArg->getLocStart(), AthenaError);
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(defArg->getSourceRange(), true));
}
continue;
}
}
@ -305,10 +308,13 @@ public:
const clang::Expr* expr = arg.getAsExpr();
endianExpr = expr;
if (expr->isIntegerConstantExpr(endian, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getLocStart(), AthenaError);
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
}
continue;
}
}
@ -316,6 +322,8 @@ public:
int endianVal = endian.getSExtValue();
if (endianVal != 0 && endianVal != 1)
{
if (!p)
{
if (endianExpr)
{
@ -329,14 +337,18 @@ public:
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
}
continue;
}
if (ioOp.empty())
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(field->getLocStart(), AthenaError);
diag.AddString("Unable to use type '" + tsDecl->getNameAsString() + "' with Athena");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
continue;
}
@ -368,10 +380,13 @@ public:
const clang::Expr* defArg = nttParm->getDefaultArgument();
endianExpr = defArg;
if (!defArg->isIntegerConstantExpr(endian, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(defArg->getLocStart(), AthenaError);
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(defArg->getSourceRange(), true));
}
continue;
}
}
@ -416,10 +431,13 @@ public:
{
endianExpr = expr;
if (!expr->isIntegerConstantExpr(endian, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getLocStart(), AthenaError);
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
}
bad = true;
break;
}
@ -432,6 +450,8 @@ public:
int endianVal = endian.getSExtValue();
if (endianVal != 0 && endianVal != 1)
{
if (!p)
{
if (endianExpr)
{
@ -445,22 +465,29 @@ public:
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
}
continue;
}
if (ioOp.empty())
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(field->getLocStart(), AthenaError);
diag.AddString("Unable to use type '" + templateType.getAsString() + "' with Athena");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
continue;
}
if (sizeExpr.empty())
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(field->getLocStart(), AthenaError);
diag.AddString("Unable to use count variable with Athena");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
continue;
}
@ -485,7 +512,8 @@ public:
" " << fieldName << ".back()." << ioOp << "\n"
" }\n";
else
fileOut << " for (int i=0 ; i<(" << sizeExpr << ") ; ++i)\n " << fieldName << ".push_back(" << ioOp << ");\n";
fileOut << " for (int i=0 ; i<(" << sizeExpr << ") ; ++i)\n"
" " << fieldName << ".push_back(" << ioOp << ");\n";
}
else
{
@ -519,6 +547,8 @@ public:
}
}
if (sizeExprStr.empty())
{
if (!p)
{
if (sizeExpr)
{
@ -532,6 +562,7 @@ public:
diag.AddString("Unable to use size variable with Athena");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
}
continue;
}
@ -593,10 +624,13 @@ public:
const clang::Expr* defArg = nttParm->getDefaultArgument();
endianExpr = defArg;
if (!defArg->isIntegerConstantExpr(endian, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(defArg->getLocStart(), AthenaError);
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(defArg->getSourceRange(), true));
}
continue;
}
}
@ -634,10 +668,13 @@ public:
{
endianExpr = expr;
if (!expr->isIntegerConstantExpr(endian, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getLocStart(), AthenaError);
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
}
bad = true;
break;
}
@ -650,6 +687,8 @@ public:
int endianVal = endian.getSExtValue();
if (endianVal != 0 && endianVal != 1)
{
if (!p)
{
if (endianExpr)
{
@ -663,6 +702,7 @@ public:
diag.AddString("Endian value must be 'BigEndian' or 'LittleEndian'");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
}
continue;
}
@ -730,10 +770,13 @@ public:
if (!idx)
{
if (!expr->isIntegerConstantExpr(offset, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getLocStart(), AthenaError);
diag.AddString("Unable to use non-constant offset expression in Athena");
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
}
bad = true;
break;
}
@ -742,10 +785,13 @@ public:
{
directionExpr = expr;
if (!expr->isIntegerConstantExpr(direction, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getLocStart(), AthenaError);
diag.AddString("Unable to use non-constant direction expression in Athena");
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
}
bad = true;
break;
}
@ -759,6 +805,8 @@ public:
int64_t offsetVal = offset.getSExtValue();
int64_t directionVal = direction.getSExtValue();
if (directionVal < 0 || directionVal > 2)
{
if (!p)
{
if (directionExpr)
{
@ -772,6 +820,7 @@ public:
diag.AddString("Direction parameter must be 'Begin', 'Current', or 'End'");
diag.AddSourceRange(clang::CharSourceRange(field->getSourceRange(), true));
}
}
continue;
}
@ -809,10 +858,13 @@ public:
{
const clang::Expr* expr = arg.getAsExpr();
if (!expr->isIntegerConstantExpr(align, context))
{
if (!p)
{
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getLocStart(), AthenaError);
diag.AddString("Unable to use non-constant align expression in Athena");
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
}
bad = true;
break;
}
@ -835,16 +887,16 @@ public:
else if (align.isPowerOf2())
{
if (!p)
fileOut << " reader.seek((reader.position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", SeekOrigin::Begin);\n";
fileOut << " reader.seek((reader.position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", Athena::Begin);\n";
else
fileOut << " writer.seek((writer.position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", SeekOrigin::Begin);\n";
fileOut << " writer.seek((writer.position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", Athena::Begin);\n";
}
else
{
if (!p)
fileOut << " reader.seek((reader.position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", SeekOrigin::Begin);\n";
fileOut << " reader.seek((reader.position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", Athena::Begin);\n";
else
fileOut << " writer.seek((writer.position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", SeekOrigin::Begin);\n";
fileOut << " writer.seek((writer.position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", Athena::Begin);\n";
}
}
}