void FormatASTNodeDiagnosticArgument(
DiagnosticsEngine::ArgumentKind Kind,
intptr_t Val,
- const char *Modifier,
- unsigned ModLen,
- const char *Argument,
- unsigned ArgLen,
+ StringRef Modifier,
+ StringRef Argument,
ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
/// 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,
+ StringRef Modifier, StringRef Argument,
ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
/// \brief Converts a diagnostic argument (as an intptr_t) into the string
/// that represents it.
void ConvertArgToString(ArgumentKind Kind, intptr_t Val,
- const char *Modifier, unsigned ModLen,
- const char *Argument, unsigned ArgLen,
+ StringRef Modifier, StringRef Argument,
ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
ArrayRef<intptr_t> QualTypeVals) const {
- ArgToStringFn(Kind, Val, Modifier, ModLen, Argument, ArgLen,
- PrevArgs, Output, ArgToStringCookie,
- QualTypeVals);
+ ArgToStringFn(Kind, Val, Modifier, Argument, PrevArgs, Output,
+ ArgToStringCookie, QualTypeVals);
}
void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie) {
void clang::FormatASTNodeDiagnosticArgument(
DiagnosticsEngine::ArgumentKind Kind,
intptr_t Val,
- const char *Modifier,
- unsigned ModLen,
- const char *Argument,
- unsigned ArgLen,
+ StringRef Modifier,
+ StringRef Argument,
ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
// Attempting to do a template diff on non-templates. Set the variables
// and continue with regular type printing of the appropriate type.
Val = TDT.PrintFromType ? TDT.FromType : TDT.ToType;
- ModLen = 0;
- ArgLen = 0;
+ Modifier = StringRef();
+ Argument = StringRef();
// Fall through
}
case DiagnosticsEngine::ak_qualtype: {
- assert(ModLen == 0 && ArgLen == 0 &&
+ assert(Modifier.empty() && Argument.empty() &&
"Invalid modifier for QualType argument");
QualType Ty(QualType::getFromOpaquePtr(reinterpret_cast<void*>(Val)));
break;
}
case DiagnosticsEngine::ak_declarationname: {
- if (ModLen == 9 && !memcmp(Modifier, "objcclass", 9) && ArgLen == 0)
+ if (Modifier == "objcclass" && Argument.empty())
OS << '+';
- else if (ModLen == 12 && !memcmp(Modifier, "objcinstance", 12)
- && ArgLen==0)
+ else if (Modifier == "objcinstance" && Argument.empty())
OS << '-';
else
- assert(ModLen == 0 && ArgLen == 0 &&
+ assert(Modifier.empty() && Argument.empty() &&
"Invalid modifier for DeclarationName argument");
OS << DeclarationName::getFromOpaqueInteger(Val);
}
case DiagnosticsEngine::ak_nameddecl: {
bool Qualified;
- if (ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0)
+ if (Modifier == "q" && Argument.empty())
Qualified = true;
else {
- assert(ModLen == 0 && ArgLen == 0 &&
+ assert(Modifier.empty() && Argument.empty() &&
"Invalid modifier for NamedDecl* argument");
Qualified = false;
}
using namespace clang;
static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT,
- const char *Modifier, unsigned ML,
- const char *Argument, unsigned ArgLen,
+ StringRef Modifier, StringRef Argument,
ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
case DiagnosticsEngine::ak_declcontext:
case DiagnosticsEngine::ak_attr:
getDiags()->ConvertArgToString(Kind, getRawArg(ArgNo),
- Modifier, ModifierLen,
- Argument, ArgumentLen,
+ StringRef(Modifier, ModifierLen),
+ StringRef(Argument, ArgumentLen),
FormattedArgs,
OutStr, QualTypeVals);
break;
TDT.PrintFromType = true;
TDT.PrintTree = true;
getDiags()->ConvertArgToString(Kind, val,
- Modifier, ModifierLen,
- Argument, ArgumentLen,
+ StringRef(Modifier, ModifierLen),
+ StringRef(Argument, ArgumentLen),
FormattedArgs,
Tree, QualTypeVals);
// If there is no tree information, fall back to regular printing.
TDT.PrintTree = false;
TDT.PrintFromType = true;
getDiags()->ConvertArgToString(Kind, val,
- Modifier, ModifierLen,
- Argument, ArgumentLen,
+ StringRef(Modifier, ModifierLen),
+ StringRef(Argument, ArgumentLen),
FormattedArgs,
OutStr, QualTypeVals);
if (!TDT.TemplateDiffUsed)
// Append second type
TDT.PrintFromType = false;
getDiags()->ConvertArgToString(Kind, val,
- Modifier, ModifierLen,
- Argument, ArgumentLen,
+ StringRef(Modifier, ModifierLen),
+ StringRef(Argument, ArgumentLen),
FormattedArgs,
OutStr, QualTypeVals);
if (!TDT.TemplateDiffUsed)
SmallString<32> Buffer;
CGM.getDiags().ConvertArgToString(DiagnosticsEngine::ak_qualtype,
(intptr_t)T.getAsOpaquePtr(),
- nullptr, 0, nullptr, 0, None, Buffer,
+ StringRef(), StringRef(), None, Buffer,
ArrayRef<intptr_t>());
llvm::Constant *Components[] = {