Reikriam

clang diff with test

May 2nd, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
  2. index 0d2e54d8d9a..c2c07c6e8f0 100644
  3. --- a/clang/lib/AST/TemplateBase.cpp
  4. +++ b/clang/lib/AST/TemplateBase.cpp
  5. @@ -76,13 +76,20 @@ static void printIntegral(const TemplateArgument &TemplArg,
  6. Out.write_escaped(StringRef(&Ch, 1), /*UseHexEscapes=*/ true);
  7. Out << "'";
  8. } else {
  9. - Out << Val;
  10. if (T->isBuiltinType()) {
  11. - if (Val.isUnsigned())
  12. - Out << "U";
  13. - if (Val.getBitWidth() == 64)
  14. - Out << "LL";
  15. + if (T->isUnsignedIntegerType() && Val.getBitWidth() == 64)
  16. + Out << Val << "ULL";
  17. + else if (T->isSignedIntegerType() && Val.getBitWidth() == 64)
  18. + Out << Val << "LL";
  19. + else if (T->isUnsignedIntegerType())
  20. + Out << Val << "U";
  21. + else if (T->getCanonicalTypeInternal().getAsString(Policy) == "int")
  22. + Out << Val;
  23. + else
  24. + Out << "(" << T->getCanonicalTypeInternal().getAsString(Policy) << ")" << Val;
  25. }
  26. + else
  27. + Out << Val;
  28. }
  29. }
  30.  
  31. diff --git a/clang/test/Misc/integer-literal-printing.cpp b/clang/test/Misc/integer-literal-printing.cpp
  32. index bd73a63f264..ba8427c56a3 100644
  33. --- a/clang/test/Misc/integer-literal-printing.cpp
  34. +++ b/clang/test/Misc/integer-literal-printing.cpp
  35. @@ -2,7 +2,7 @@
  36.  
  37. // PR11179
  38. template <short T> class Type1 {};
  39. -template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = -42] not viable: expects an l-value for 1st argument}}
  40. +template <short T> void Function1(Type1<T>& x) {} // expected-note{{candidate function [with T = (short)-42] not viable: expects an l-value for 1st argument}}
  41.  
  42. template <unsigned short T> class Type2 {};
  43. template <unsigned short T> void Function2(Type2<T>& x) {} // expected-note{{candidate function [with T = 42U] not viable: expects an l-value for 1st argument}}
Add Comment
Please, Sign In to add comment