Format all lines with leading =
This is the unadorned output of: git grep -En "^\s*=" -- ':!tests/*' | grep-format There are some examples with comments between the variable name and the '=' that clang-format left unchanged. No functional change.
This commit is contained in:
parent
890a3150d7
commit
b65c4b63a7
78
iwyu.cc
78
iwyu.cc
|
@ -571,8 +571,8 @@ class BaseAstVisitor : public RecursiveASTVisitor<Derived> {
|
|||
const NamedDecl* member_decl = TypeToDeclAsWritten(type);
|
||||
// We only want those fields that are c++ classes.
|
||||
if (const CXXRecordDecl* cxx_field_decl = DynCastFrom(member_decl)) {
|
||||
if (const CXXDestructorDecl* field_dtor
|
||||
= cxx_field_decl->getDestructor()) {
|
||||
if (const CXXDestructorDecl* field_dtor =
|
||||
cxx_field_decl->getDestructor()) {
|
||||
if (!this->getDerived().TraverseImplicitDestructorCall(
|
||||
const_cast<CXXDestructorDecl*>(field_dtor), type))
|
||||
return false;
|
||||
|
@ -864,8 +864,8 @@ class AstFlattenerVisitor : public BaseAstVisitor<AstFlattenerVisitor> {
|
|||
bool Contains(const ASTNode& node) const {
|
||||
if (const TypeLoc* tl = node.GetAs<TypeLoc>()) {
|
||||
return ContainsValue(typelocs, *tl);
|
||||
} else if (const NestedNameSpecifierLoc* nl
|
||||
= node.GetAs<NestedNameSpecifierLoc>()) {
|
||||
} else if (const NestedNameSpecifierLoc* nl =
|
||||
node.GetAs<NestedNameSpecifierLoc>()) {
|
||||
return ContainsValue(nnslocs, *nl);
|
||||
} else if (const TemplateName* tn = node.GetAs<TemplateName>()) {
|
||||
// The best we can do is to compare the associated decl
|
||||
|
@ -881,7 +881,7 @@ class AstFlattenerVisitor : public BaseAstVisitor<AstFlattenerVisitor> {
|
|||
(void)ta;
|
||||
return false;
|
||||
} else if (const TemplateArgumentLoc* tal =
|
||||
node.GetAs<TemplateArgumentLoc>()) {
|
||||
node.GetAs<TemplateArgumentLoc>()) {
|
||||
// TODO(csilvers): figure out how to compare template argument-locs
|
||||
(void)tal;
|
||||
return false;
|
||||
|
@ -1440,10 +1440,10 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
//
|
||||
// for type 'reference' it will return type T with which Foo was instantiated.
|
||||
const Type* DesugarDependentTypedef(const TypedefType* typedef_type) {
|
||||
const DeclContext* parent
|
||||
= typedef_type->getDecl()->getLexicalDeclContext();
|
||||
if (const ClassTemplateSpecializationDecl* template_parent
|
||||
= DynCastFrom(parent)) {
|
||||
const DeclContext* parent =
|
||||
typedef_type->getDecl()->getLexicalDeclContext();
|
||||
if (const ClassTemplateSpecializationDecl* template_parent =
|
||||
DynCastFrom(parent)) {
|
||||
return DesugarDependentTypedef(typedef_type, template_parent);
|
||||
}
|
||||
return typedef_type;
|
||||
|
@ -1451,8 +1451,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
|
||||
const Type* DesugarDependentTypedef(
|
||||
const TypedefType* typedef_type, const RecordDecl* parent) {
|
||||
const Type* underlying_type
|
||||
= typedef_type->getDecl()->getUnderlyingType().getTypePtr();
|
||||
const Type* underlying_type =
|
||||
typedef_type->getDecl()->getUnderlyingType().getTypePtr();
|
||||
if (const TypedefType* underlying_typedef = DynCastFrom(underlying_type)) {
|
||||
if (underlying_typedef->getDecl()->getLexicalDeclContext() == parent) {
|
||||
return DesugarDependentTypedef(underlying_typedef, parent);
|
||||
|
@ -1476,8 +1476,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
}
|
||||
}
|
||||
|
||||
const Type* deref_type
|
||||
= RemovePointersAndReferencesAsWritten(underlying_type);
|
||||
const Type* deref_type =
|
||||
RemovePointersAndReferencesAsWritten(underlying_type);
|
||||
if (isa<SubstTemplateTypeParmType>(underlying_type) ||
|
||||
CodeAuthorWantsJustAForwardDeclare(deref_type, GetLocation(decl))) {
|
||||
retval.insert(deref_type);
|
||||
|
@ -1622,8 +1622,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
// underlying type. Instead, users of that typedef are.
|
||||
const ASTNode* ast_node = MostElaboratedAncestor(current_ast_node());
|
||||
if (!ast_node->ParentIsA<TypedefNameDecl>()) {
|
||||
const set<const Type*>& underlying_types
|
||||
= GetCallerResponsibleTypesForTypedef(typedef_decl);
|
||||
const set<const Type*>& underlying_types =
|
||||
GetCallerResponsibleTypesForTypedef(typedef_decl);
|
||||
if (!underlying_types.empty()) {
|
||||
VERRS(6) << "User, not author, of typedef "
|
||||
<< typedef_decl->getQualifiedNameAsString()
|
||||
|
@ -1782,8 +1782,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
if (CanIgnoreCurrentASTNode())
|
||||
return true;
|
||||
const Type* underlying_type = decl->getUnderlyingType().getTypePtr();
|
||||
const Type* deref_type
|
||||
= RemovePointersAndReferencesAsWritten(underlying_type);
|
||||
const Type* deref_type =
|
||||
RemovePointersAndReferencesAsWritten(underlying_type);
|
||||
|
||||
if (CodeAuthorWantsJustAForwardDeclare(deref_type, GetLocation(decl)) ||
|
||||
isa<SubstTemplateTypeParmType>(underlying_type)) {
|
||||
|
@ -1839,16 +1839,16 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
|
||||
// ...except the return value.
|
||||
const Type* return_type = Desugar(decl->getReturnType().getTypePtr());
|
||||
const bool is_responsible_for_return_type
|
||||
= (!CanIgnoreType(return_type) &&
|
||||
!IsPointerOrReferenceAsWritten(return_type) &&
|
||||
!CodeAuthorWantsJustAForwardDeclare(return_type, GetLocation(decl)));
|
||||
const bool is_responsible_for_return_type =
|
||||
(!CanIgnoreType(return_type) &&
|
||||
!IsPointerOrReferenceAsWritten(return_type) &&
|
||||
!CodeAuthorWantsJustAForwardDeclare(return_type, GetLocation(decl)));
|
||||
// Don't bother to report here, when the language agrees with us
|
||||
// we need the full type; that will be reported elsewhere, so
|
||||
// reporting here would be double-counting.
|
||||
const bool type_use_reported_in_visit_function_type
|
||||
= (!current_ast_node()->in_forward_declare_context() ||
|
||||
!IsClassType(return_type));
|
||||
const bool type_use_reported_in_visit_function_type =
|
||||
(!current_ast_node()->in_forward_declare_context() ||
|
||||
!IsClassType(return_type));
|
||||
if (is_responsible_for_return_type &&
|
||||
!type_use_reported_in_visit_function_type) {
|
||||
ReportTypeUse(GetLocation(decl), return_type, "(for fn return type)");
|
||||
|
@ -2129,7 +2129,7 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
const Expr* base_expr = expr->getBase()->IgnoreParenImpCasts();
|
||||
const Type* base_type = GetTypeOf(base_expr);
|
||||
CHECK_(base_type && "Member's base does not have a type?");
|
||||
const Type* deref_base_type // For myvar->a, base-type will have a *
|
||||
const Type* deref_base_type // For myvar->a, base-type will have a *
|
||||
= expr->isArrow() ? RemovePointerFromType(base_type) : base_type;
|
||||
if (CanIgnoreType(base_type) && CanIgnoreType(deref_base_type))
|
||||
return true;
|
||||
|
@ -2566,8 +2566,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
fn_type = current_ast_node()->template GetParentAs<FunctionProtoType>();
|
||||
}
|
||||
if (!fn_type) {
|
||||
if (const FunctionDecl* fn_decl
|
||||
= current_ast_node()->template GetParentAs<FunctionDecl>())
|
||||
if (const FunctionDecl* fn_decl =
|
||||
current_ast_node()->template GetParentAs<FunctionDecl>())
|
||||
fn_type = dyn_cast<FunctionProtoType>(GetTypeOf(fn_decl));
|
||||
}
|
||||
if (fn_type) {
|
||||
|
@ -3410,8 +3410,8 @@ class InstantiatedTemplateVisitor
|
|||
// them here.
|
||||
AstFlattenerVisitor nodeset_getter(compiler());
|
||||
// This gets to the decl for the (uninstantiated) template-as-written:
|
||||
const FunctionDecl* decl_as_written
|
||||
= fn_decl->getTemplateInstantiationPattern();
|
||||
const FunctionDecl* decl_as_written =
|
||||
fn_decl->getTemplateInstantiationPattern();
|
||||
if (!decl_as_written) {
|
||||
if (fn_decl->isImplicit()) { // TIP not set up for implicit methods
|
||||
// TODO(csilvers): handle implicit template methods
|
||||
|
@ -3609,8 +3609,8 @@ class InstantiatedTemplateVisitor
|
|||
if (resugared_type && !resugared_type->isPointerType()) {
|
||||
ReportTypeUse(caller_loc(), resugared_type);
|
||||
// For a templated type, check the template args as well.
|
||||
if (const TemplateSpecializationType* spec_type
|
||||
= DynCastFrom(resugared_type)) {
|
||||
if (const TemplateSpecializationType* spec_type =
|
||||
DynCastFrom(resugared_type)) {
|
||||
TraverseDataAndTypeMembersOfClassHelper(spec_type);
|
||||
}
|
||||
}
|
||||
|
@ -3757,8 +3757,8 @@ class IwyuAstConsumer
|
|||
if (compiler()->getDiagnostics().hasUnrecoverableErrorOccurred())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
const set<const FileEntry*>* const files_to_report_iwyu_violations_for
|
||||
= preprocessor_info().files_to_report_iwyu_violations_for();
|
||||
const set<const FileEntry*>* const files_to_report_iwyu_violations_for =
|
||||
preprocessor_info().files_to_report_iwyu_violations_for();
|
||||
|
||||
// Some analysis, such as UsingDecl resolution, is deferred until the
|
||||
// entire AST is visited because it's only at that point that we know if
|
||||
|
@ -4199,8 +4199,8 @@ class IwyuAstConsumer
|
|||
// If we're not in a forward-declare context, use of a template
|
||||
// specialization requires having the full type information.
|
||||
if (!CanForwardDeclareType(current_ast_node())) {
|
||||
const map<const Type*, const Type*> resugar_map
|
||||
= GetTplTypeResugarMapForClass(type);
|
||||
const map<const Type*, const Type*> resugar_map =
|
||||
GetTplTypeResugarMapForClass(type);
|
||||
|
||||
instantiated_template_visitor_.ScanInstantiatedType(current_ast_node(),
|
||||
resugar_map);
|
||||
|
@ -4262,8 +4262,8 @@ class IwyuAstConsumer
|
|||
if (!IsTemplatizedFunctionDecl(callee) && !IsTemplatizedType(parent_type))
|
||||
return true;
|
||||
|
||||
map<const Type*, const Type*> resugar_map
|
||||
= GetTplTypeResugarMapForFunction(callee, calling_expr);
|
||||
map<const Type*, const Type*> resugar_map =
|
||||
GetTplTypeResugarMapForFunction(callee, calling_expr);
|
||||
|
||||
if (parent_type) { // means we're a method of a class
|
||||
InsertAllInto(GetTplTypeResugarMapForClass(parent_type), &resugar_map);
|
||||
|
@ -4305,8 +4305,8 @@ class IwyuAction : public ASTFrontendAction {
|
|||
std::unique_ptr<PPCallbacks>(preprocessor_consumer));
|
||||
compiler.getPreprocessor().addCommentHandler(preprocessor_consumer);
|
||||
|
||||
auto* const visitor_state
|
||||
= new VisitorState(&compiler, *preprocessor_consumer);
|
||||
auto* const visitor_state =
|
||||
new VisitorState(&compiler, *preprocessor_consumer);
|
||||
return std::unique_ptr<IwyuAstConsumer>(new IwyuAstConsumer(visitor_state));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -350,11 +350,10 @@ const NestedNameSpecifier* GetQualifier(const ASTNode* ast_node) {
|
|||
const NestedNameSpecifier* nns = nullptr;
|
||||
if (ast_node->IsA<TemplateName>()) {
|
||||
const TemplateName* tn = ast_node->GetAs<TemplateName>();
|
||||
if (const DependentTemplateName* dtn
|
||||
= tn->getAsDependentTemplateName())
|
||||
if (const DependentTemplateName* dtn = tn->getAsDependentTemplateName())
|
||||
nns = dtn->getQualifier();
|
||||
else if (const QualifiedTemplateName* qtn
|
||||
= tn->getAsQualifiedTemplateName())
|
||||
else if (const QualifiedTemplateName* qtn =
|
||||
tn->getAsQualifiedTemplateName())
|
||||
nns = qtn->getQualifier();
|
||||
}
|
||||
if (!nns) nns = TryGetQualifier<ElaboratedType>(ast_node);
|
||||
|
@ -729,8 +728,8 @@ static map<const Type*, const Type*> GetTplTypeResugarMapForFunctionNoCallExpr(
|
|||
map<const Type*, const Type*> retval;
|
||||
if (!decl) // can be nullptr if the function call is via a function pointer
|
||||
return retval;
|
||||
if (const TemplateArgumentList* tpl_list
|
||||
= decl->getTemplateSpecializationArgs()) {
|
||||
if (const TemplateArgumentList* tpl_list =
|
||||
decl->getTemplateSpecializationArgs()) {
|
||||
for (unsigned i = start_arg; i < tpl_list->size(); ++i) {
|
||||
if (const Type* arg_type = GetTemplateArgAsType(tpl_list->get(i))) {
|
||||
retval[GetCanonicalType(arg_type)] = arg_type;
|
||||
|
@ -826,8 +825,8 @@ map<const Type*, const Type*> GetTplTypeResugarMapForFunction(
|
|||
fn_args = call_expr->getArgs();
|
||||
num_args = call_expr->getNumArgs();
|
||||
const Expr* callee_expr = call_expr->getCallee()->IgnoreParenCasts();
|
||||
const TemplateArgumentListInfo& explicit_tpl_args
|
||||
= GetExplicitTplArgs(callee_expr);
|
||||
const TemplateArgumentListInfo& explicit_tpl_args =
|
||||
GetExplicitTplArgs(callee_expr);
|
||||
if (explicit_tpl_args.size() > 0) {
|
||||
retval = GetTplTypeResugarMapForFunctionExplicitTplArgs(
|
||||
decl, explicit_tpl_args);
|
||||
|
@ -835,8 +834,8 @@ map<const Type*, const Type*> GetTplTypeResugarMapForFunction(
|
|||
}
|
||||
} else {
|
||||
// If calling_expr has explicit template args, then consider them.
|
||||
const TemplateArgumentListInfo& explicit_tpl_args
|
||||
= GetExplicitTplArgs(calling_expr);
|
||||
const TemplateArgumentListInfo& explicit_tpl_args =
|
||||
GetExplicitTplArgs(calling_expr);
|
||||
if (explicit_tpl_args.size() > 0) {
|
||||
retval = GetTplTypeResugarMapForFunctionExplicitTplArgs(
|
||||
decl, explicit_tpl_args);
|
||||
|
@ -855,8 +854,8 @@ map<const Type*, const Type*> GetTplTypeResugarMapForFunction(
|
|||
// operator<<(basic_ostream<char, T>& o, int i);
|
||||
// If I pass in an ostream as the first argument, then no part
|
||||
// of the (sugared) argument types match T, so we ignore it.
|
||||
const map<const Type*, const Type*>& desugared_types
|
||||
= GetTplTypeResugarMapForFunctionNoCallExpr(decl, start_of_implicit_args);
|
||||
const map<const Type*, const Type*>& desugared_types =
|
||||
GetTplTypeResugarMapForFunctionNoCallExpr(decl, start_of_implicit_args);
|
||||
|
||||
// TODO(csilvers): SubstTemplateTypeParms are always desugared,
|
||||
// making this less useful than it should be.
|
||||
|
@ -1254,15 +1253,14 @@ static const NamedDecl* TypeToDeclImpl(const Type* type, bool as_written) {
|
|||
|
||||
if (const TypedefType* typedef_type = DynCastFrom(type)) {
|
||||
return typedef_type->getDecl();
|
||||
} else if (const InjectedClassNameType* icn_type
|
||||
= type->getAs<InjectedClassNameType>()) {
|
||||
} else if (const InjectedClassNameType* icn_type =
|
||||
type->getAs<InjectedClassNameType>()) {
|
||||
return icn_type->getDecl();
|
||||
} else if (as_written && template_decl &&
|
||||
isa<TypeAliasTemplateDecl>(template_decl)) {
|
||||
// A template type alias
|
||||
return template_decl;
|
||||
} else if (const RecordType* record_type
|
||||
= type->getAs<RecordType>()) {
|
||||
} else if (const RecordType* record_type = type->getAs<RecordType>()) {
|
||||
return record_type->getDecl();
|
||||
} else if (const TagType* tag_type = DynCastFrom(type)) {
|
||||
return tag_type->getDecl(); // probably just enums
|
||||
|
@ -1273,7 +1271,7 @@ static const NamedDecl* TypeToDeclImpl(const Type* type, bool as_written) {
|
|||
// TODO(csilvers): is it possible to map from fn type to fn decl?
|
||||
(void)function_type;
|
||||
return nullptr;
|
||||
} else {
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1343,8 +1341,8 @@ GetTplTypeResugarMapForClassNoComponentTypes(const clang::Type* type) {
|
|||
set<unsigned> explicit_args; // indices into tpl_args we've filled
|
||||
TypeEnumerator type_enumerator;
|
||||
for (unsigned i = 0; i < tpl_spec_type->template_arguments().size(); ++i) {
|
||||
set<const Type*> arg_components
|
||||
= type_enumerator.Enumerate(tpl_spec_type->template_arguments()[i]);
|
||||
set<const Type*> arg_components =
|
||||
type_enumerator.Enumerate(tpl_spec_type->template_arguments()[i]);
|
||||
// Go through all template types mentioned in the arg-as-written,
|
||||
// and compare it against each of the types in the template decl
|
||||
// (the latter are all desugared). If there's a match, update
|
||||
|
@ -1470,14 +1468,13 @@ const CXXDestructorDecl* GetSiblingDestructorFor(
|
|||
|
||||
const FunctionType* GetCalleeFunctionType(CallExpr* expr) {
|
||||
const Type* callee_type = expr->getCallee()->getType().getTypePtr();
|
||||
if (const PointerType* ptr_type
|
||||
= callee_type->getAs<PointerType>()) {
|
||||
if (const PointerType* ptr_type = callee_type->getAs<PointerType>()) {
|
||||
callee_type = ptr_type->getPointeeType().getTypePtr();
|
||||
} else if (const BlockPointerType* bptr_type
|
||||
= callee_type->getAs<BlockPointerType>()) {
|
||||
} else if (const BlockPointerType* bptr_type =
|
||||
callee_type->getAs<BlockPointerType>()) {
|
||||
callee_type = bptr_type->getPointeeType().getTypePtr();
|
||||
} else if (const MemberPointerType* mptr_type
|
||||
= callee_type->getAs<MemberPointerType>()) {
|
||||
} else if (const MemberPointerType* mptr_type =
|
||||
callee_type->getAs<MemberPointerType>()) {
|
||||
callee_type = mptr_type->getPointeeType().getTypePtr();
|
||||
}
|
||||
return callee_type->getAs<FunctionType>();
|
||||
|
|
|
@ -72,8 +72,8 @@ map<const Type*, const Type*> FullUseCache::GetPrecomputedResugarMap(
|
|||
// The code below doesn't handle template-template args/etc. None
|
||||
// of the types in kFullUseTypes should have those. Just verify,
|
||||
// when we can.
|
||||
if (const ClassTemplateSpecializationDecl* tpl_spec_decl
|
||||
= DynCastFrom(tpl_decl)) {
|
||||
if (const ClassTemplateSpecializationDecl* tpl_spec_decl =
|
||||
DynCastFrom(tpl_decl)) {
|
||||
const TemplateArgumentList& all_tpl_args = tpl_spec_decl->getTemplateArgs();
|
||||
for (unsigned i = 0; i < all_tpl_args.size(); ++i) {
|
||||
CHECK_((all_tpl_args.get(i).getKind() == TemplateArgument::Type)
|
||||
|
|
|
@ -133,18 +133,16 @@ SourceLocation GetLocation(const clang::Stmt* stmt) {
|
|||
return call_expr->getOperatorLoc();
|
||||
} else if (const MemberExpr* member_expr = DynCastFrom(stmt)) {
|
||||
return GetMemberExprLocation(member_expr);
|
||||
} else if (const UnresolvedMemberExpr* member_expr
|
||||
= DynCastFrom(stmt)) {
|
||||
} else if (const UnresolvedMemberExpr* member_expr = DynCastFrom(stmt)) {
|
||||
if (member_expr->getOperatorLoc().isValid())
|
||||
return member_expr->getOperatorLoc();
|
||||
} else if (const CXXDependentScopeMemberExpr* member_expr
|
||||
= DynCastFrom(stmt)) {
|
||||
} else if (const CXXDependentScopeMemberExpr* member_expr =
|
||||
DynCastFrom(stmt)) {
|
||||
if (member_expr->getOperatorLoc().isValid())
|
||||
return member_expr->getOperatorLoc();
|
||||
} else if (const BinaryOperator* binary_op = DynCastFrom(stmt)) {
|
||||
return binary_op->getOperatorLoc();
|
||||
} else if (const ConditionalOperator* conditional_op =
|
||||
DynCastFrom(stmt)) {
|
||||
} else if (const ConditionalOperator* conditional_op = DynCastFrom(stmt)) {
|
||||
return conditional_op->getQuestionLoc();
|
||||
} else if (const UnaryOperator* unary_op = DynCastFrom(stmt)) {
|
||||
// Drill through unary operators and parentheses, to get at the underlying
|
||||
|
|
|
@ -1425,9 +1425,9 @@ void CalculateIwyuForForwardDeclareUse(
|
|||
|
||||
const NamedDecl* dfn = GetTagDefinition(use->decl());
|
||||
if (dfn) {
|
||||
vector<string> headers
|
||||
= GlobalIncludePicker().GetCandidateHeadersForFilepathIncludedFrom(
|
||||
GetFilePath(dfn), GetFilePath(use->use_loc()));
|
||||
vector<string> headers =
|
||||
GlobalIncludePicker().GetCandidateHeadersForFilepathIncludedFrom(
|
||||
GetFilePath(dfn), GetFilePath(use->use_loc()));
|
||||
for (const string& header : headers) {
|
||||
if (ContainsKey(desired_includes, header))
|
||||
dfn_is_in_desired_includes = true;
|
||||
|
@ -1491,8 +1491,8 @@ void CalculateIwyuForForwardDeclareUse(
|
|||
|
||||
// Be sure to store as a TemplateClassDecl if we're a templated
|
||||
// class.
|
||||
if (const ClassTemplateSpecializationDecl* spec_decl
|
||||
= DynCastFrom(use->decl())) {
|
||||
if (const ClassTemplateSpecializationDecl* spec_decl =
|
||||
DynCastFrom(use->decl())) {
|
||||
use->reset_decl(spec_decl->getSpecializedTemplate());
|
||||
} else if (const CXXRecordDecl* cxx_decl = DynCastFrom(use->decl())) {
|
||||
if (cxx_decl->getDescribedClassTemplate())
|
||||
|
@ -1612,8 +1612,8 @@ void IwyuFileInfo::CalculateIwyuViolations(vector<OneUse>* uses) {
|
|||
// The 'effective' direct includes are defined to be the current
|
||||
// includes of associated, plus us. This is only used to decide
|
||||
// when to give iwyu warnings.
|
||||
const set<string> effective_direct_includes
|
||||
= Union(associated_direct_includes, direct_includes());
|
||||
const set<string> effective_direct_includes =
|
||||
Union(associated_direct_includes, direct_includes());
|
||||
|
||||
// (C2) + (C3) Find the minimal 'set cover' for all symbol uses.
|
||||
const set<string> desired_set_cover = internal::CalculateMinimalIncludes(
|
||||
|
|
|
@ -261,8 +261,8 @@ void IwyuPreprocessorInfo::HandlePragmaComment(SourceRange comment_range) {
|
|||
return;
|
||||
}
|
||||
|
||||
const string quoted_this_file
|
||||
= ConvertToQuotedInclude(GetFilePath(begin_loc));
|
||||
const string quoted_this_file =
|
||||
ConvertToQuotedInclude(GetFilePath(begin_loc));
|
||||
|
||||
VERRS(8) << "Adding dynamic mapping for private pragma\n";
|
||||
MutableGlobalIncludePicker()->AddMapping(quoted_this_file,
|
||||
|
@ -875,8 +875,8 @@ void IwyuPreprocessorInfo::ReportMacroUse(const string& name,
|
|||
// As above, but get the definition location from macros_definition_loc_.
|
||||
void IwyuPreprocessorInfo::FindAndReportMacroUse(const string& name,
|
||||
SourceLocation loc) {
|
||||
if (const SourceLocation* dfn_loc
|
||||
= FindInMap(¯os_definition_loc_, name)) {
|
||||
if (const SourceLocation* dfn_loc =
|
||||
FindInMap(¯os_definition_loc_, name)) {
|
||||
ReportMacroUse(name, loc, *dfn_loc);
|
||||
}
|
||||
}
|
||||
|
@ -887,8 +887,8 @@ void IwyuPreprocessorInfo::FindAndReportMacroUse(const string& name,
|
|||
// Adds of includer's includes, direct or indirect, into retval.
|
||||
void IwyuPreprocessorInfo::AddAllIncludesAsFileEntries(
|
||||
const FileEntry* includer, set<const FileEntry*>* retval) const {
|
||||
set<const FileEntry*> direct_incs
|
||||
= FileInfoOrEmptyFor(includer).direct_includes_as_fileentries();
|
||||
set<const FileEntry*> direct_incs =
|
||||
FileInfoOrEmptyFor(includer).direct_includes_as_fileentries();
|
||||
for (const FileEntry* include : direct_incs) {
|
||||
if (ContainsKey(*retval, include)) // avoid infinite recursion
|
||||
continue;
|
||||
|
@ -933,8 +933,8 @@ void IwyuPreprocessorInfo::PopulateIntendsToProvideMap() {
|
|||
if (picker.IsPublic(file)) {
|
||||
AddAllIncludesAsFileEntries(file, &intends_to_provide_map_[file]);
|
||||
} else {
|
||||
const set<const FileEntry*>& direct_includes
|
||||
= fileinfo.second.direct_includes_as_fileentries();
|
||||
const set<const FileEntry*>& direct_includes =
|
||||
fileinfo.second.direct_includes_as_fileentries();
|
||||
for (const FileEntry* inc : direct_includes) {
|
||||
intends_to_provide_map_[file].insert(inc);
|
||||
if (picker.IsPublic(inc))
|
||||
|
@ -948,8 +948,8 @@ void IwyuPreprocessorInfo::PopulateIntendsToProvideMap() {
|
|||
const FileEntry* file = fileinfo.first;
|
||||
// See if a round-trip to string and back ends up at a different file.
|
||||
const string quoted_include = ConvertToQuotedInclude(GetFilePath(file));
|
||||
const FileEntry* other_file
|
||||
= GetOrDefault(include_to_fileentry_map_, quoted_include, file);
|
||||
const FileEntry* other_file =
|
||||
GetOrDefault(include_to_fileentry_map_, quoted_include, file);
|
||||
if (other_file != file) {
|
||||
InsertAllInto(intends_to_provide_map_[file],
|
||||
&intends_to_provide_map_[other_file]);
|
||||
|
@ -1071,8 +1071,8 @@ const IwyuFileInfo& IwyuPreprocessorInfo::FileInfoOrEmptyFor(
|
|||
|
||||
bool IwyuPreprocessorInfo::PublicHeaderIntendsToProvide(
|
||||
const FileEntry* public_header, const FileEntry* other_file) const {
|
||||
if (const set<const FileEntry*>* provides
|
||||
= FindInMap(&intends_to_provide_map_, public_header)) {
|
||||
if (const set<const FileEntry*>* provides =
|
||||
FindInMap(&intends_to_provide_map_, public_header)) {
|
||||
return ContainsKey(*provides, other_file);
|
||||
}
|
||||
return false;
|
||||
|
@ -1080,8 +1080,8 @@ bool IwyuPreprocessorInfo::PublicHeaderIntendsToProvide(
|
|||
|
||||
bool IwyuPreprocessorInfo::FileTransitivelyIncludes(
|
||||
const FileEntry* includer, const FileEntry* includee) const {
|
||||
if (const set<const FileEntry*>* all_includes
|
||||
= FindInMap(&transitive_include_map_, includer)) {
|
||||
if (const set<const FileEntry*>* all_includes =
|
||||
FindInMap(&transitive_include_map_, includer)) {
|
||||
return ContainsKey(*all_includes, includee);
|
||||
}
|
||||
return false;
|
||||
|
@ -1089,8 +1089,8 @@ bool IwyuPreprocessorInfo::FileTransitivelyIncludes(
|
|||
|
||||
bool IwyuPreprocessorInfo::FileTransitivelyIncludes(
|
||||
const FileEntry* includer, const string& quoted_includee) const {
|
||||
if (const set<const FileEntry*>* all_includes
|
||||
= FindInMap(&transitive_include_map_, includer)) {
|
||||
if (const set<const FileEntry*>* all_includes =
|
||||
FindInMap(&transitive_include_map_, includer)) {
|
||||
for (const FileEntry* include : *all_includes) {
|
||||
if (ConvertToQuotedInclude(GetFilePath(include)) == quoted_includee)
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue