diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 01:11:32 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 01:11:32 +0000 |
commit | ae100e6994a304739d95ac3b1b625a054704c907 (patch) | |
tree | 1b3effd4aa0c6a3868a4eb12458be2fe7847f726 /tools/clang | |
parent | b9d224c8ffd5f16b3c5219547d841d63b6cf4354 (diff) | |
download | chromium_src-ae100e6994a304739d95ac3b1b625a054704c907.zip chromium_src-ae100e6994a304739d95ac3b1b625a054704c907.tar.gz chromium_src-ae100e6994a304739d95ac3b1b625a054704c907.tar.bz2 |
clang: Check if namespace string is empty using empty() accessor.
R=erg@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10735067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/clang')
-rw-r--r-- | tools/clang/plugins/ChromeClassTester.cpp | 13 | ||||
-rw-r--r-- | tools/clang/plugins/ChromeClassTester.h | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp index 7a3b89e..49c5ce4 100644 --- a/tools/clang/plugins/ChromeClassTester.cpp +++ b/tools/clang/plugins/ChromeClassTester.cpp @@ -91,12 +91,12 @@ void ChromeClassTester::emitWarning(SourceLocation loc, DiagnosticsEngine::Error : DiagnosticsEngine::Warning; unsigned id = diagnostic().getCustomDiagID(level, err); - DiagnosticBuilder B = diagnostic().Report(full, id); + DiagnosticBuilder builder = diagnostic().Report(full, id); } bool ChromeClassTester::InBannedNamespace(const Decl* record) { std::string n = GetNamespace(record); - if (n != "") { + if (!n.empty()) { return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) != banned_namespaces_.end(); } @@ -110,9 +110,8 @@ std::string ChromeClassTester::GetNamespace(const Decl* record) { bool ChromeClassTester::InImplementationFile(SourceLocation record_location) { std::string filename; - if (!GetFilename(record_location, &filename)) { + if (!GetFilename(record_location, &filename)) return false; - } if (ends_with(filename, ".cc") || ends_with(filename, ".cpp") || ends_with(filename, ".mm")) { @@ -267,9 +266,9 @@ bool ChromeClassTester::IsIgnoredType(const std::string& base_name) { bool ChromeClassTester::GetFilename(SourceLocation loc, std::string* filename) { - const SourceManager &SM = instance_.getSourceManager(); - SourceLocation spelling_location = SM.getSpellingLoc(loc); - PresumedLoc ploc = SM.getPresumedLoc(spelling_location); + const SourceManager& source_manager = instance_.getSourceManager(); + SourceLocation spelling_location = source_manager.getSpellingLoc(loc); + PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); if (ploc.isInvalid()) { // If we're in an invalid location, we're looking at things that aren't // actually stated in the source. diff --git a/tools/clang/plugins/ChromeClassTester.h b/tools/clang/plugins/ChromeClassTester.h index 5994a71..f6d2e68 100644 --- a/tools/clang/plugins/ChromeClassTester.h +++ b/tools/clang/plugins/ChromeClassTester.h @@ -21,7 +21,7 @@ class ChromeClassTester : public clang::ASTConsumer { explicit ChromeClassTester(clang::CompilerInstance& instance); virtual ~ChromeClassTester(); - // ASTConsumer: + // clang::ASTConsumer: virtual void HandleTagDeclDefinition(clang::TagDecl* tag); protected: |