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

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

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 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 | « tools/battor_agent/battor_finder.cc ('k') | tools/cygprofile/cygprofile.h » ('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 #include "FindBadConstructsConsumer.h" 5 #include "FindBadConstructsConsumer.h"
6 6
7 #include "clang/Frontend/CompilerInstance.h" 7 #include "clang/Frontend/CompilerInstance.h"
8 #include "clang/AST/Attr.h" 8 #include "clang/AST/Attr.h"
9 #include "clang/Lex/Lexer.h" 9 #include "clang/Lex/Lexer.h"
10 #include "clang/Sema/Sema.h" 10 #include "clang/Sema/Sema.h"
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 } 768 }
769 769
770 // Check |record| to determine if it has any problematic refcounting 770 // Check |record| to determine if it has any problematic refcounting
771 // issues and, if so, print them as warnings/errors based on the current 771 // issues and, if so, print them as warnings/errors based on the current
772 // value of getErrorLevel(). 772 // value of getErrorLevel().
773 // 773 //
774 // If |record| is a C++ class, and if it inherits from one of the Chromium 774 // If |record| is a C++ class, and if it inherits from one of the Chromium
775 // ref-counting classes (base::RefCounted / base::RefCountedThreadSafe), 775 // ref-counting classes (base::RefCounted / base::RefCountedThreadSafe),
776 // ensure that there are no public destructors in the class hierarchy. This 776 // ensure that there are no public destructors in the class hierarchy. This
777 // is to guard against accidentally stack-allocating a RefCounted class or 777 // is to guard against accidentally stack-allocating a RefCounted class or
778 // sticking it in a non-ref-counted container (like scoped_ptr<>). 778 // sticking it in a non-ref-counted container (like std::unique_ptr<>).
779 void FindBadConstructsConsumer::CheckRefCountedDtors( 779 void FindBadConstructsConsumer::CheckRefCountedDtors(
780 SourceLocation record_location, 780 SourceLocation record_location,
781 CXXRecordDecl* record) { 781 CXXRecordDecl* record) {
782 // Skip anonymous structs. 782 // Skip anonymous structs.
783 if (record->getIdentifier() == NULL) 783 if (record->getIdentifier() == NULL)
784 return; 784 return;
785 785
786 // Determine if the current type is even ref-counted. 786 // Determine if the current type is even ref-counted.
787 CXXBasePaths refcounted_path; 787 CXXBasePaths refcounted_path;
788 if (!record->lookupInBases( 788 if (!record->lookupInBases(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 instance().getSourceManager().getSpellingLoc(fd->getLocation()))) 943 instance().getSourceManager().getSpellingLoc(fd->getLocation())))
944 continue; 944 continue;
945 945
946 // Parse and build AST for yet-uninstantiated template functions. 946 // Parse and build AST for yet-uninstantiated template functions.
947 clang::LateParsedTemplate* lpt = sema.LateParsedTemplateMap[fd]; 947 clang::LateParsedTemplate* lpt = sema.LateParsedTemplateMap[fd];
948 sema.LateTemplateParser(sema.OpaqueParser, *lpt); 948 sema.LateTemplateParser(sema.OpaqueParser, *lpt);
949 } 949 }
950 } 950 }
951 951
952 } // namespace chrome_checker 952 } // namespace chrome_checker
OLDNEW
« no previous file with comments | « tools/battor_agent/battor_finder.cc ('k') | tools/cygprofile/cygprofile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698