41 lines · cpp
1// RUN: %check_clang_tidy %s google-readability-namespace-comments %t \2// RUN: -config='{CheckOptions: { \3// RUN: google-readability-namespace-comments.AllowOmittingNamespaceComments: true, \4// RUN: google-readability-namespace-comments.ShortNamespaceLines: 0, \5// RUN: }}'6 7// accept if namespace comments are fully omitted8namespace n1 {9namespace /* a comment */ n2 /* another comment */ {10void f();11}}12 13#define MACRO macro_expansion14namespace MACRO {15void f();16}17 18namespace [[deprecated("foo")]] namespace_with_attr {19inline namespace inline_namespace {20void f();21}22}23 24namespace [[]] {25void f();26}27 28// accept if namespace comments are partly omitted (e.g. only for nested namespace)29namespace n3 {30namespace n4 {31void f();32} // n433}34 35// fail if namespace comment is different than expected36namespace n1 {37void f();38} // namespace n239// CHECK-MESSAGES: :[[@LINE-1]]:2: warning: namespace 'n1' ends with a comment that refers to a wrong namespace 'n2' [google-readability-namespace-comments]40 41