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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 CheckChromeEnum(enum_location, enum_decl); | 88 CheckChromeEnum(enum_location, enum_decl); |
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 // TODO(dcheng): Re-enable -Werror for these diagnostics on Windows once all |
| 99 // the pre-existing warnings are cleaned up. https://crbug.com/467287 |
98 DiagnosticIDs::Level level = | 100 DiagnosticIDs::Level level = |
| 101 #if !defined(LLVM_ON_WIN32) |
99 diagnostic().getWarningsAsErrors() ? | 102 diagnostic().getWarningsAsErrors() ? |
100 DiagnosticIDs::Error : | 103 DiagnosticIDs::Error : |
| 104 #endif |
101 DiagnosticIDs::Warning; | 105 DiagnosticIDs::Warning; |
102 unsigned id = diagnostic().getDiagnosticIDs()->getCustomDiagID(level, err); | 106 unsigned id = diagnostic().getDiagnosticIDs()->getCustomDiagID(level, err); |
103 DiagnosticBuilder builder = diagnostic().Report(full, id); | 107 DiagnosticBuilder builder = diagnostic().Report(full, id); |
104 } | 108 } |
105 | 109 |
106 bool ChromeClassTester::InBannedNamespace(const Decl* record) { | 110 bool ChromeClassTester::InBannedNamespace(const Decl* record) { |
107 std::string n = GetNamespace(record); | 111 std::string n = GetNamespace(record); |
108 if (!n.empty()) { | 112 if (!n.empty()) { |
109 return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) | 113 return std::find(banned_namespaces_.begin(), banned_namespaces_.end(), n) |
110 != banned_namespaces_.end(); | 114 != banned_namespaces_.end(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 297 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
294 if (ploc.isInvalid()) { | 298 if (ploc.isInvalid()) { |
295 // If we're in an invalid location, we're looking at things that aren't | 299 // If we're in an invalid location, we're looking at things that aren't |
296 // actually stated in the source. | 300 // actually stated in the source. |
297 return false; | 301 return false; |
298 } | 302 } |
299 | 303 |
300 *filename = ploc.getFilename(); | 304 *filename = ploc.getFilename(); |
301 return true; | 305 return true; |
302 } | 306 } |
OLD | NEW |