default:
return 1;
case AsLongLong:
+ case AsChar:
return 2;
case None:
return 0;
}
const char *getStart() const {
- return start;
+ // We include the . character if it is given.
+ return start - UsesDotPrefix;
}
unsigned getConstantLength() const {
assert(hs == Constant);
- return length;
+ return length + UsesDotPrefix;
}
ArgTypeResult getArgType(ASTContext &Ctx) const;
//===----------------------------------------------------------------------===//
void OptionalAmount::toString(llvm::raw_ostream &os) const {
- if (UsesDotPrefix)
- os << ".";
-
switch (hs) {
case Invalid:
case NotSpecified:
return;
case Arg:
+ if (UsesDotPrefix)
+ os << ".";
if (usesPositionalArg())
os << "*" << getPositionalArgIndex() << "$";
else
os << "*";
break;
case Constant:
+ if (UsesDotPrefix)
+ os << ".";
os << amt;
break;
}
// RUN: cp %s %t
// RUN: %clang_cc1 -pedantic -Wall -fixit %t || true
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror %t
+// XFAIL: *
+// FIXME: Some of these tests currently fail due to a bug in the HighlightRange
+// function in lib/Frontend/TextDiagnosticPrinter.cpp.
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
// Flag handling
printf("%0+s", (unsigned) 31337); // flags should stay
printf("%0f", "test"); // flag should be removed
+ printf("%#p", (void *) 0);
// Positional arguments
printf("%1$f:%2$.*3$f:%4$.*3$f\n", 1, 2, 3, 4);
+
+ // Precision
+ printf("%10.5d", 1l); // (bug 7394)
+ printf("%.2c", 'a');
+
+ // Ignored flags
+ printf("%0-f", 1.23);
+
+ // Bad length modifiers
+ printf("%hhs", "foo");
+ printf("%1$zp", (void *)0);
}