Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: tools/clang/plugins/ChromeClassTester.cpp

Issue 10005022: Check for public dtors on base::RefCounted types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/plugins/ChromeClassTester.cpp
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp
index 0bf4ba511adfc9e250fca7d2d4d602144e88d010..dea977f106d85725ed153e957e27cba0047b08d2 100644
--- a/tools/clang/plugins/ChromeClassTester.cpp
+++ b/tools/clang/plugins/ChromeClassTester.cpp
@@ -9,6 +9,8 @@
#include <sys/param.h>
+#include <string>
+
#include "clang/Basic/FileManager.h"
using namespace clang;
@@ -171,6 +173,22 @@ bool ChromeClassTester::InBannedNamespace(const Decl* record) {
return false;
}
+bool ChromeClassTester::InImplementationFile(
+ const SourceLocation& record_location) {
+ const SourceManager &SM = instance().getSourceManager();
+ SourceLocation spelling_location = SM.getSpellingLoc(record_location);
+ PresumedLoc ploc = SM.getPresumedLoc(spelling_location);
+ if (ploc.isInvalid())
+ return false;
+
+ std::string b = ploc.getFilename();
+
+ if (ends_with(b, ".cc") || ends_with(b, ".cpp") || ends_with(b, ".mm"))
+ return true;
+
+ return false;
+}
+
std::string ChromeClassTester::GetNamespace(const Decl* record) {
return GetNamespaceImpl(record->getDeclContext(), "");
}
@@ -217,11 +235,6 @@ bool ChromeClassTester::InBannedDirectory(SourceLocation loc) {
if (b == "<scratch space>")
return true;
- // Don't complain about these things in implementation files.
- if (ends_with(b, ".cc") || ends_with(b, ".cpp") || ends_with(b, ".mm")) {
- return true;
- }
-
// Don't complain about autogenerated protobuf files.
if (ends_with(b, ".pb.h")) {
return true;

Powered by Google App Engine
This is Rietveld 408576698