[PATCH] D125580: Resolve overload ambiguity on Mac OS when printing size_t in diagnostics

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 14 03:38:11 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGac7a9ef0ae3a: Resolve overload ambiguity on Mac OS when printing size_t in diagnostics (authored by aaronpuchert).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125580/new/

https://reviews.llvm.org/D125580

Files:
  clang/include/clang/Basic/Diagnostic.h
  clang/lib/AST/CommentParser.cpp


Index: clang/lib/AST/CommentParser.cpp
===================================================================
--- clang/lib/AST/CommentParser.cpp
+++ clang/lib/AST/CommentParser.cpp
@@ -414,7 +414,7 @@
   if (Args.size() < Info->NumArgs) {
     Diag(CommandTok.getEndLocation().getLocWithOffset(1),
          diag::warn_doc_inline_command_not_enough_arguments)
-        << CommandTok.is(tok::at_command) << Info->Name << (uint64_t)Args.size()
+        << CommandTok.is(tok::at_command) << Info->Name << Args.size()
         << Info->NumArgs
         << SourceRange(CommandTok.getLocation(), CommandTok.getEndLocation());
   }
Index: clang/include/clang/Basic/Diagnostic.h
===================================================================
--- clang/include/clang/Basic/Diagnostic.h
+++ clang/include/clang/Basic/Diagnostic.h
@@ -1404,7 +1404,13 @@
 }
 
 inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
-                                             int64_t I) {
+                                             long I) {
+  DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint);
+  return DB;
+}
+
+inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+                                             long long I) {
   DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint);
   return DB;
 }
@@ -1426,7 +1432,13 @@
 }
 
 inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
-                                             uint64_t I) {
+                                             unsigned long I) {
+  DB.AddTaggedVal(I, DiagnosticsEngine::ak_uint);
+  return DB;
+}
+
+inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+                                             unsigned long long I) {
   DB.AddTaggedVal(I, DiagnosticsEngine::ak_uint);
   return DB;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125580.429433.patch
Type: text/x-patch
Size: 1834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220514/e0da22f3/attachment.bin>


More information about the cfe-commits mailing list