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

Side by Side Diff: tools/clang/plugins/ChromeClassTester.cpp

Issue 2749043004: Clang plugin: Support for Blink in web/. (Closed)
Patch Set: plugin argument approach Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/clang/plugins/FindBadConstructsAction.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 size_needed = WideCharToMultiByte(CP_UTF8, 0, full_utf16.data(), -1, 150 size_needed = WideCharToMultiByte(CP_UTF8, 0, full_utf16.data(), -1,
151 nullptr, 0, nullptr, nullptr); 151 nullptr, 0, nullptr, nullptr);
152 filename.resize(size_needed); 152 filename.resize(size_needed);
153 WideCharToMultiByte(CP_UTF8, 0, full_utf16.data(), -1, &filename[0], 153 WideCharToMultiByte(CP_UTF8, 0, full_utf16.data(), -1, &filename[0],
154 size_needed, nullptr, nullptr); 154 size_needed, nullptr, nullptr);
155 } 155 }
156 156
157 std::replace(filename.begin(), filename.end(), '\\', '/'); 157 std::replace(filename.begin(), filename.end(), '\\', '/');
158 #endif 158 #endif
159 159
160 if (options_.check_for_blink)
dcheng 2017/04/17 02:40:57 Hmm, so the potential issue with this is that Blin
tkent 2017/04/17 08:00:23 Ah, I see.
161 return LocationType::kBlink;
162 // TODO(tkent): Remove blink_directories_. We specify "-Xclang
163 // -plugin-arg-find-bad-constructs -Xclang check-for-blink" in BUILD.gn
164 // instead.
160 for (const std::string& blink_dir : blink_directories_) { 165 for (const std::string& blink_dir : blink_directories_) {
161 // If any of the allowed directories occur as a component in filename, 166 // If any of the allowed directories occur as a component in filename,
162 // this file is allowed. 167 // this file is allowed.
163 assert(blink_dir.front() == '/' && "Allowed dir must start with '/'"); 168 assert(blink_dir.front() == '/' && "Allowed dir must start with '/'");
164 assert(blink_dir.back() == '/' && "Allowed dir must end with '/'"); 169 assert(blink_dir.back() == '/' && "Allowed dir must end with '/'");
165 170
166 if (filename.find(blink_dir) != std::string::npos) 171 if (filename.find(blink_dir) != std::string::npos)
167 return LocationType::kBlink; 172 return LocationType::kBlink;
168 } 173 }
169 174
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 339 }
335 340
336 *filename = ploc.getFilename(); 341 *filename = ploc.getFilename();
337 return true; 342 return true;
338 } 343 }
339 344
340 DiagnosticsEngine::Level ChromeClassTester::getErrorLevel() { 345 DiagnosticsEngine::Level ChromeClassTester::getErrorLevel() {
341 return diagnostic().getWarningsAsErrors() ? DiagnosticsEngine::Error 346 return diagnostic().getWarningsAsErrors() ? DiagnosticsEngine::Error
342 : DiagnosticsEngine::Warning; 347 : DiagnosticsEngine::Warning;
343 } 348 }
OLDNEW
« no previous file with comments | « no previous file | tools/clang/plugins/FindBadConstructsAction.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698