unsigned ModLen,
const char *Argument,
unsigned ArgLen,
- const DiagnosticsEngine::ArgumentValue *PrevArgs,
- unsigned NumPrevArgs,
+ ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
ArrayRef<intptr_t> QualTypeVals);
///
/// This takes the modifiers and argument that was present in the diagnostic.
///
- /// The PrevArgs array (whose length is NumPrevArgs) indicates the previous
- /// arguments formatted for this diagnostic. Implementations of this function
- /// can use this information to avoid redundancy across arguments.
+ /// The PrevArgs array indicates the previous arguments formatted for this
+ /// diagnostic. Implementations of this function can use this information to
+ /// avoid redundancy across arguments.
///
/// This is a hack to avoid a layering violation between libbasic and libsema.
typedef void (*ArgToStringFnTy)(
ArgumentKind Kind, intptr_t Val,
const char *Modifier, unsigned ModifierLen,
const char *Argument, unsigned ArgumentLen,
- const ArgumentValue *PrevArgs,
- unsigned NumPrevArgs,
+ ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
ArrayRef<intptr_t> QualTypeVals);
void ConvertArgToString(ArgumentKind Kind, intptr_t Val,
const char *Modifier, unsigned ModLen,
const char *Argument, unsigned ArgLen,
- const ArgumentValue *PrevArgs, unsigned NumPrevArgs,
+ ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
ArrayRef<intptr_t> QualTypeVals) const {
ArgToStringFn(Kind, Val, Modifier, ModLen, Argument, ArgLen,
- PrevArgs, NumPrevArgs, Output, ArgToStringCookie,
+ PrevArgs, Output, ArgToStringCookie,
QualTypeVals);
}
/// diagnostic message
static std::string
ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
- const DiagnosticsEngine::ArgumentValue *PrevArgs,
- unsigned NumPrevArgs,
- ArrayRef<intptr_t> QualTypeVals) {
+ ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
+ ArrayRef<intptr_t> QualTypeVals) {
// FIXME: Playing with std::string is really slow.
bool ForceAKA = false;
QualType CanTy = Ty.getCanonicalType();
// Check to see if we already desugared this type in this
// diagnostic. If so, don't do it again.
bool Repeated = false;
- for (unsigned i = 0; i != NumPrevArgs; ++i) {
+ for (unsigned i = 0, e = PrevArgs.size(); i != e; ++i) {
// TODO: Handle ak_declcontext case.
if (PrevArgs[i].first == DiagnosticsEngine::ak_qualtype) {
void *Ptr = (void*)PrevArgs[i].second;
unsigned ModLen,
const char *Argument,
unsigned ArgLen,
- const DiagnosticsEngine::ArgumentValue *PrevArgs,
- unsigned NumPrevArgs,
+ ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
ArrayRef<intptr_t> QualTypeVals) {
"Invalid modifier for QualType argument");
QualType Ty(QualType::getFromOpaquePtr(reinterpret_cast<void*>(Val)));
- OS << ConvertTypeToDiagnosticString(Context, Ty, PrevArgs, NumPrevArgs,
- QualTypeVals);
+ OS << ConvertTypeToDiagnosticString(Context, Ty, PrevArgs, QualTypeVals);
NeedQuotes = false;
break;
}
} else if (TypeDecl *Type = dyn_cast<TypeDecl>(DC)) {
OS << ConvertTypeToDiagnosticString(Context,
Context.getTypeDeclType(Type),
- PrevArgs, NumPrevArgs,
- QualTypeVals);
+ PrevArgs, QualTypeVals);
} else {
// FIXME: Get these strings from some localized place
if (isa<BlockDecl>(DC)) {
using namespace clang;
static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT,
- const char *Modifier, unsigned ML,
- const char *Argument, unsigned ArgLen,
- const DiagnosticsEngine::ArgumentValue *PrevArgs,
- unsigned NumPrevArgs,
- SmallVectorImpl<char> &Output,
- void *Cookie,
- ArrayRef<intptr_t> QualTypeVals) {
- const char *Str = "<can't format argument>";
- Output.append(Str, Str+strlen(Str));
+ const char *Modifier, unsigned ML,
+ const char *Argument, unsigned ArgLen,
+ ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
+ SmallVectorImpl<char> &Output,
+ void *Cookie,
+ ArrayRef<intptr_t> QualTypeVals) {
+ StringRef Str = "<can't format argument>";
+ Output.append(Str.begin(), Str.end());
}
getDiags()->ConvertArgToString(Kind, getRawArg(ArgNo),
Modifier, ModifierLen,
Argument, ArgumentLen,
- FormattedArgs.data(), FormattedArgs.size(),
+ FormattedArgs,
OutStr, QualTypeVals);
break;
case DiagnosticsEngine::ak_qualtype_pair:
getDiags()->ConvertArgToString(Kind, val,
Modifier, ModifierLen,
Argument, ArgumentLen,
- FormattedArgs.data(),
- FormattedArgs.size(),
+ FormattedArgs,
Tree, QualTypeVals);
// If there is no tree information, fall back to regular printing.
if (!Tree.empty()) {
getDiags()->ConvertArgToString(Kind, val,
Modifier, ModifierLen,
Argument, ArgumentLen,
- FormattedArgs.data(), FormattedArgs.size(),
+ FormattedArgs,
OutStr, QualTypeVals);
if (!TDT.TemplateDiffUsed)
FormattedArgs.push_back(std::make_pair(DiagnosticsEngine::ak_qualtype,
getDiags()->ConvertArgToString(Kind, val,
Modifier, ModifierLen,
Argument, ArgumentLen,
- FormattedArgs.data(), FormattedArgs.size(),
+ FormattedArgs,
OutStr, QualTypeVals);
if (!TDT.TemplateDiffUsed)
FormattedArgs.push_back(std::make_pair(DiagnosticsEngine::ak_qualtype,
SmallString<32> Buffer;
CGM.getDiags().ConvertArgToString(DiagnosticsEngine::ak_qualtype,
(intptr_t)T.getAsOpaquePtr(),
- nullptr, 0, nullptr, 0, nullptr, 0, Buffer,
+ nullptr, 0, nullptr, 0, None, Buffer,
ArrayRef<intptr_t>());
llvm::Constant *Components[] = {