Mercurial > hg > CbC > CbC_llvm
comparison clang-tools-extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp @ 173:0572611fdcc8 llvm10 llvm12
reorgnization done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 11:55:54 +0900 |
parents | 1d019706d866 |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
172:9fbae9c8bf63 | 173:0572611fdcc8 |
---|---|
25 unless(isConstexpr())); | 25 unless(isConstexpr())); |
26 | 26 |
27 const auto ReferencesUndefinedGlobalVar = declRefExpr(hasDeclaration( | 27 const auto ReferencesUndefinedGlobalVar = declRefExpr(hasDeclaration( |
28 varDecl(GlobalVarDecl, unless(isDefinition())).bind("referencee"))); | 28 varDecl(GlobalVarDecl, unless(isDefinition())).bind("referencee"))); |
29 | 29 |
30 Finder->addMatcher( | 30 Finder->addMatcher(traverse(ast_type_traits::TK_AsIs, |
31 varDecl(GlobalVarDecl, isDefinition(), | 31 varDecl(GlobalVarDecl, isDefinition(), |
32 hasInitializer(expr(hasDescendant(ReferencesUndefinedGlobalVar)))) | 32 hasInitializer(expr(hasDescendant( |
33 .bind("var"), | 33 ReferencesUndefinedGlobalVar)))) |
34 this); | 34 .bind("var")), |
35 this); | |
35 } | 36 } |
36 | 37 |
37 void InterfacesGlobalInitCheck::check(const MatchFinder::MatchResult &Result) { | 38 void InterfacesGlobalInitCheck::check(const MatchFinder::MatchResult &Result) { |
38 const auto *const Var = Result.Nodes.getNodeAs<VarDecl>("var"); | 39 const auto *const Var = Result.Nodes.getNodeAs<VarDecl>("var"); |
39 // For now assume that people who write macros know what they're doing. | 40 // For now assume that people who write macros know what they're doing. |