This revision was automatically updated to reflect the committed changes. Closed by commit rL360698: [clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance… (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D61874?vs=199333&id=199484#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61874/new/ https://reviews.llvm.org/D61874 Files: clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp Index: clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp @@ -67,6 +67,7 @@ const ASTContext *AstContext = Result.Context; PrintingPolicy PrintingPolicyWithSupressedTag(AstContext->getLangOpts()); PrintingPolicyWithSupressedTag.SuppressTagKeyword = true; + PrintingPolicyWithSupressedTag.SuppressUnwrittenScope = true; std::string BaseTypeName = BaseType.getAsString(PrintingPolicyWithSupressedTag); Index: clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp @@ -220,3 +220,31 @@ qp->y = 10; // OK, the overloaded operator might have side-effects. qp->K = 10; // } + +namespace { + struct Anonymous { + static int I; + }; +} + +void use_anonymous() { + Anonymous Anon; + Anon.I; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member + // CHECK-FIXES: {{^}} Anonymous::I;{{$}} +} + +namespace Outer { + inline namespace Inline { + struct S { + static int I; + }; + } +} + +void use_inline() { + Outer::S V; + V.I; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member + // CHECK-FIXES: {{^}} Outer::S::I;{{$}} +}
Index: clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp @@ -67,6 +67,7 @@ const ASTContext *AstContext = Result.Context; PrintingPolicy PrintingPolicyWithSupressedTag(AstContext->getLangOpts()); PrintingPolicyWithSupressedTag.SuppressTagKeyword = true; + PrintingPolicyWithSupressedTag.SuppressUnwrittenScope = true; std::string BaseTypeName = BaseType.getAsString(PrintingPolicyWithSupressedTag); Index: clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp @@ -220,3 +220,31 @@ qp->y = 10; // OK, the overloaded operator might have side-effects. qp->K = 10; // } + +namespace { + struct Anonymous { + static int I; + }; +} + +void use_anonymous() { + Anonymous Anon; + Anon.I; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member + // CHECK-FIXES: {{^}} Anonymous::I;{{$}} +} + +namespace Outer { + inline namespace Inline { + struct S { + static int I; + }; + } +} + +void use_inline() { + Outer::S V; + V.I; + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member + // CHECK-FIXES: {{^}} Outer::S::I;{{$}} +}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits