S.PDiag(diag::warn_printf_conversion_argument_type_mismatch)
<< ATR.getRepresentativeTypeName(S.Context) << Ex->getType()
<< Ex->getSourceRange(),
- getLocationOfByte(CS.getStart()),
- /*IsStringLocation*/true,
+ Ex->getLocStart(),
+ /*IsStringLocation*/false,
getSpecifierRange(startSpecifier, specifierLen),
FixItHint::CreateReplacement(
getSpecifierRange(startSpecifier, specifierLen),
<< ATR.getRepresentativeTypeName(S.Context) << Ex->getType()
<< getSpecifierRange(startSpecifier, specifierLen)
<< Ex->getSourceRange(),
- getLocationOfByte(CS.getStart()),
- true,
+ Ex->getLocStart(),
+ /*IsStringLocation*/false,
getSpecifierRange(startSpecifier, specifierLen));
}
}
S.PDiag(diag::warn_printf_conversion_argument_type_mismatch)
<< ATR.getRepresentativeTypeName(S.Context) << Ex->getType()
<< Ex->getSourceRange(),
- getLocationOfByte(CS.getStart()),
- /*IsStringLocation*/true,
+ Ex->getLocStart(),
+ /*IsStringLocation*/false,
getSpecifierRange(startSpecifier, specifierLen),
FixItHint::CreateReplacement(
getSpecifierRange(startSpecifier, specifierLen),
S.PDiag(diag::warn_printf_conversion_argument_type_mismatch)
<< ATR.getRepresentativeTypeName(S.Context) << Ex->getType()
<< Ex->getSourceRange(),
- getLocationOfByte(CS.getStart()),
- /*IsStringLocation*/true,
+ Ex->getLocStart(),
+ /*IsStringLocation*/false,
getSpecifierRange(startSpecifier, specifierLen));
}
}
printf("%a", (long double)0); // expected-warning{{format specifies type 'double' but the argument has type 'long double'}}
// Test braced char[] initializers.
- const char kFormat18[] = { "%lld" }; // expected-note{{format string is defined here}}}
+ const char kFormat18[] = { "%lld" }; // expected-note{{format string is defined here}}
printf(kFormat18, 0); // expected-warning{{format specifies type}}
+
+ // Make sure we point at the offending argument rather than the format string.
+ const char kFormat19[] = "%d"; // expected-note{{format string is defined here}}
+ printf(kFormat19,
+ 0.0); // expected-warning{{format specifies}}
}
// PR 9466: clang: doesn't know about %Lu, %Ld, and %Lx