| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // A general interface for filtering and only acting on classes in Chromium C++ | 5 // A general interface for filtering and only acting on classes in Chromium C++ |
| 6 // code. | 6 // code. |
| 7 | 7 |
| 8 #include "ChromeClassTester.h" | 8 #include "ChromeClassTester.h" |
| 9 | 9 |
| 10 #include <sys/param.h> | 10 #include <sys/param.h> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 CheckChromeEnum(enum_location, enum_decl); | 103 CheckChromeEnum(enum_location, enum_decl); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ChromeClassTester::emitWarning(SourceLocation loc, | 107 void ChromeClassTester::emitWarning(SourceLocation loc, |
| 108 const char* raw_error) { | 108 const char* raw_error) { |
| 109 FullSourceLoc full(loc, instance().getSourceManager()); | 109 FullSourceLoc full(loc, instance().getSourceManager()); |
| 110 std::string err; | 110 std::string err; |
| 111 err = "[chromium-style] "; | 111 err = "[chromium-style] "; |
| 112 err += raw_error; | 112 err += raw_error; |
| 113 DiagnosticsEngine::Level level = | 113 DiagnosticIDs::Level level = |
| 114 diagnostic().getWarningsAsErrors() ? | 114 diagnostic().getWarningsAsErrors() ? |
| 115 DiagnosticsEngine::Error : | 115 DiagnosticIDs::Error : |
| 116 DiagnosticsEngine::Warning; | 116 DiagnosticIDs::Warning; |
| 117 unsigned id = diagnostic().getCustomDiagID(level, err); | 117 unsigned id = diagnostic().getDiagnosticIDs()->getCustomDiagID(level, err); |
| 118 DiagnosticBuilder builder = diagnostic().Report(full, id); | 118 DiagnosticBuilder builder = diagnostic().Report(full, id); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool ChromeClassTester::InBannedNamespace(const Decl* record) { | 121 bool ChromeClassTester::InBannedNamespace(const Decl* record) { |
| 122 std::string n = GetNamespace(record); | 122 std::string n = GetNamespace(record); |
| 123 if (!n.empty()) { | 123 if (!n.empty()) { |
| 124 return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) | 124 return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) |
| 125 != banned_namespaces_.end(); | 125 != banned_namespaces_.end(); |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 308 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
| 309 if (ploc.isInvalid()) { | 309 if (ploc.isInvalid()) { |
| 310 // If we're in an invalid location, we're looking at things that aren't | 310 // If we're in an invalid location, we're looking at things that aren't |
| 311 // actually stated in the source. | 311 // actually stated in the source. |
| 312 return false; | 312 return false; |
| 313 } | 313 } |
| 314 | 314 |
| 315 *filename = ploc.getFilename(); | 315 *filename = ploc.getFilename(); |
| 316 return true; | 316 return true; |
| 317 } | 317 } |
| OLD | NEW |