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 <algorithm> | 10 #include <algorithm> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void ChromeClassTester::emitWarning(SourceLocation loc, | 92 void ChromeClassTester::emitWarning(SourceLocation loc, |
93 const char* raw_error) { | 93 const char* raw_error) { |
94 FullSourceLoc full(loc, instance().getSourceManager()); | 94 FullSourceLoc full(loc, instance().getSourceManager()); |
95 std::string err; | 95 std::string err; |
96 err = "[chromium-style] "; | 96 err = "[chromium-style] "; |
97 err += raw_error; | 97 err += raw_error; |
98 DiagnosticIDs::Level level = | 98 DiagnosticIDs::Level level = |
99 #if !defined(LLVM_ON_WIN32) | |
Nico
2015/04/16 18:23:29
maybe add a '// TODO: make error on warning on win
| |
99 diagnostic().getWarningsAsErrors() ? | 100 diagnostic().getWarningsAsErrors() ? |
100 DiagnosticIDs::Error : | 101 DiagnosticIDs::Error : |
102 #endif | |
101 DiagnosticIDs::Warning; | 103 DiagnosticIDs::Warning; |
102 unsigned id = diagnostic().getDiagnosticIDs()->getCustomDiagID(level, err); | 104 unsigned id = diagnostic().getDiagnosticIDs()->getCustomDiagID(level, err); |
103 DiagnosticBuilder builder = diagnostic().Report(full, id); | 105 DiagnosticBuilder builder = diagnostic().Report(full, id); |
104 } | 106 } |
105 | 107 |
106 bool ChromeClassTester::InBannedNamespace(const Decl* record) { | 108 bool ChromeClassTester::InBannedNamespace(const Decl* record) { |
107 std::string n = GetNamespace(record); | 109 std::string n = GetNamespace(record); |
108 if (!n.empty()) { | 110 if (!n.empty()) { |
109 return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) | 111 return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) |
110 != banned_namespaces_.end(); | 112 != banned_namespaces_.end(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 295 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
294 if (ploc.isInvalid()) { | 296 if (ploc.isInvalid()) { |
295 // If we're in an invalid location, we're looking at things that aren't | 297 // If we're in an invalid location, we're looking at things that aren't |
296 // actually stated in the source. | 298 // actually stated in the source. |
297 return false; | 299 return false; |
298 } | 300 } |
299 | 301 |
300 *filename = ploc.getFilename(); | 302 *filename = ploc.getFilename(); |
301 return true; | 303 return true; |
302 } | 304 } |
OLD | NEW |