[PATCH] D111625: [clang-tidy] bugprone-argument-comment: SourceLocation valid judgment avoid emitting coredump in isInSystemHeader

gehry via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 13 01:18:19 PDT 2021


Sockke updated this revision to Diff 379296.
Sockke edited the summary of this revision.
Sockke added a reviewer: MTC.
Sockke added a comment.

Update!


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

https://reviews.llvm.org/D111625

Files:
  clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
@@ -151,3 +151,8 @@
   my_system_header_function(/*not_arg=*/1);
 }
 } // namespace system_header
+
+void testInvalidSlocCxxConstructExpr() {
+  __builtin_va_list __args;
+  // __builtin_va_list has no defination in any source file
+} 
Index: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -24,6 +24,8 @@
   if (const auto *D = Node.getDeclContext()->getEnclosingNamespaceContext())
     if (D->isStdNamespace())
       return true;
+  if (Node.getLocation().isInvalid())
+    return false;
   return Node.getASTContext().getSourceManager().isInSystemHeader(
       Node.getLocation());
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111625.379296.patch
Type: text/x-patch
Size: 1113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211013/4f64e602/attachment.bin>


More information about the cfe-commits mailing list