modernize-use-auto NFC fixes

llvm-svn: 289656
This commit is contained in:
Piotr Padlewski 2016-12-14 15:29:23 +00:00
parent facbd35696
commit 08124b110a
31 changed files with 72 additions and 117 deletions

View File

@ -709,7 +709,7 @@ void ChangeNamespaceTool::fixTypeLoc(
return;
}
const Decl *DeclCtx = Result.Nodes.getNodeAs<Decl>("dc");
const auto *DeclCtx = Result.Nodes.getNodeAs<Decl>("dc");
assert(DeclCtx && "Empty decl context.");
replaceQualifiedSymbolInDeclContext(Result, DeclCtx->getDeclContext(), Start,
End, FromDecl);

View File

@ -124,9 +124,7 @@ static void reportConflict(
bool applyAllReplacements(const std::vector<tooling::Replacement> &Replaces,
Rewriter &Rewrite) {
bool Result = true;
for (std::vector<tooling::Replacement>::const_iterator I = Replaces.begin(),
E = Replaces.end();
I != E; ++I) {
for (auto I = Replaces.begin(), E = Replaces.end(); I != E; ++I) {
if (I->isApplicable()) {
Result = I->apply(Rewrite) && Result;
} else {
@ -293,8 +291,7 @@ RangeVector calculateChangedRanges(
bool writeFiles(const clang::Rewriter &Rewrites) {
for (Rewriter::const_buffer_iterator BufferI = Rewrites.buffer_begin(),
BufferE = Rewrites.buffer_end();
for (auto BufferI = Rewrites.buffer_begin(), BufferE = Rewrites.buffer_end();
BufferI != BufferE; ++BufferI) {
StringRef FileName =
Rewrites.getSourceMgr().getFileEntryForID(BufferI->first)->getName();

View File

@ -86,14 +86,11 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
}
Finder.matchAST(AST->getASTContext());
for (std::vector<BoundNodes>::iterator MI = Matches.begin(),
ME = Matches.end();
MI != ME; ++MI) {
for (auto MI = Matches.begin(), ME = Matches.end(); MI != ME; ++MI) {
OS << "\nMatch #" << ++MatchCount << ":\n\n";
for (BoundNodes::IDToNodeMap::const_iterator BI = MI->getMap().begin(),
BE = MI->getMap().end();
BI != BE; ++BI) {
for (auto BI = MI->getMap().begin(), BE = MI->getMap().end(); BI != BE;
++BI) {
switch (QS.OutKind) {
case OK_Diag: {
clang::SourceRange R = BI->second.getSourceRange();

View File

@ -158,9 +158,7 @@ QueryRef QueryParser::completeMatcherExpression() {
std::vector<MatcherCompletion> Comps = Parser::completeExpression(
StringRef(Begin, End - Begin), CompletionPos - Begin, nullptr,
&QS.NamedValues);
for (std::vector<MatcherCompletion>::iterator I = Comps.begin(),
E = Comps.end();
I != E; ++I) {
for (auto I = Comps.begin(), E = Comps.end(); I != E; ++I) {
Completions.push_back(LineEditor::Completion(I->TypedText, I->MatcherDecl));
}
return QueryRef();

View File

@ -77,17 +77,13 @@ int main(int argc, const char **argv) {
QuerySession QS(ASTs);
if (!Commands.empty()) {
for (cl::list<std::string>::iterator I = Commands.begin(),
E = Commands.end();
I != E; ++I) {
for (auto I = Commands.begin(), E = Commands.end(); I != E; ++I) {
QueryRef Q = QueryParser::parse(*I, QS);
if (!Q->run(llvm::outs(), QS))
return 1;
}
} else if (!CommandFiles.empty()) {
for (cl::list<std::string>::iterator I = CommandFiles.begin(),
E = CommandFiles.end();
I != E; ++I) {
for (auto I = CommandFiles.begin(), E = CommandFiles.end(); I != E; ++I) {
std::ifstream Input(I->c_str());
if (!Input.is_open()) {
llvm::errs() << argv[0] << ": cannot open " << *I << "\n";

View File

@ -196,7 +196,7 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
// Add all fields between current field up until the next intializer.
for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
if (const T *D = dyn_cast<T>(*Decl)) {
if (const auto *D = dyn_cast<T>(*Decl)) {
if (DeclsToInit.count(D) > 0)
Insertions.back().Initializers.emplace_back(getName(D));
}
@ -208,7 +208,7 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
// Add remaining decls that require initialization.
for (; Decl != std::end(OrderedDecls); ++Decl) {
if (const T *D = dyn_cast<T>(*Decl)) {
if (const auto *D = dyn_cast<T>(*Decl)) {
if (DeclsToInit.count(D) > 0)
Insertions.back().Initializers.emplace_back(getName(D));
}

View File

@ -82,8 +82,7 @@ join(ArrayRef<SpecialMemberFunctionsCheck::SpecialMemberFunctionKind> SMFS,
void SpecialMemberFunctionsCheck::check(
const MatchFinder::MatchResult &Result) {
const CXXRecordDecl *MatchedDecl =
Result.Nodes.getNodeAs<CXXRecordDecl>("class-def");
const auto *MatchedDecl = Result.Nodes.getNodeAs<CXXRecordDecl>("class-def");
if (!MatchedDecl)
return;

View File

@ -75,8 +75,7 @@ static bool isStdInitializerList(QualType Type) {
}
void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
const CXXConstructorDecl *Ctor =
Result.Nodes.getNodeAs<CXXConstructorDecl>("ctor");
const auto *Ctor = Result.Nodes.getNodeAs<CXXConstructorDecl>("ctor");
// Do not be confused: isExplicit means 'explicit' keyword is present,
// isImplicit means that it's a compiler-generated constructor.
if (Ctor->isOutOfLine() || Ctor->isImplicit() || Ctor->isDeleted() ||

View File

@ -56,7 +56,7 @@ void NonConstReferences::check(const MatchFinder::MatchResult &Result) {
if (!Function->isCanonicalDecl())
return;
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Function)) {
if (const auto *Method = dyn_cast<CXXMethodDecl>(Function)) {
// Don't warn on implementations of an interface using references.
if (Method->begin_overridden_methods() != Method->end_overridden_methods())
return;

View File

@ -25,7 +25,7 @@ void TwineLocalCheck::registerMatchers(MatchFinder *Finder) {
}
void TwineLocalCheck::check(const MatchFinder::MatchResult &Result) {
const VarDecl *VD = Result.Nodes.getNodeAs<VarDecl>("variable");
const auto *VD = Result.Nodes.getNodeAs<VarDecl>("variable");
auto Diag = diag(VD->getLocation(),
"twine variables are prone to use-after-free bugs");

View File

@ -177,7 +177,7 @@ void ArgumentCommentCheck::checkCallArgs(ASTContext *Ctx,
}
void ArgumentCommentCheck::check(const MatchFinder::MatchResult &Result) {
const Expr *E = Result.Nodes.getNodeAs<Expr>("expr");
const auto *E = Result.Nodes.getNodeAs<Expr>("expr");
if (const auto *Call = dyn_cast<CallExpr>(E)) {
const FunctionDecl *Callee = Call->getDirectCallee();
if (!Callee)

View File

@ -104,8 +104,7 @@ void MoveForwardingReferenceCheck::check(
// Get the FunctionDecl and FunctionTemplateDecl containing the function
// parameter.
const FunctionDecl *FuncForParam =
dyn_cast<FunctionDecl>(ParmVar->getDeclContext());
const auto *FuncForParam = dyn_cast<FunctionDecl>(ParmVar->getDeclContext());
if (!FuncForParam)
return;
const FunctionTemplateDecl *FuncTemplate =

View File

@ -26,7 +26,7 @@ const Stmt *nextStmt(const MatchFinder::MatchResult &Result, const Stmt *S) {
auto Parents = Result.Context->getParents(*S);
if (Parents.empty())
return nullptr;
const Stmt *Parent = Parents[0].get<Stmt>();
const auto *Parent = Parents[0].get<Stmt>();
if (!Parent)
return nullptr;
const Stmt *Prev = nullptr;

View File

@ -100,10 +100,8 @@ void ThrowByValueCatchByReferenceCheck::diagnoseThrowLocations(
if (CheckAnonymousTemporaries) {
bool emit = false;
auto *currentSubExpr = subExpr->IgnoreImpCasts();
const DeclRefExpr *variableReference =
dyn_cast<DeclRefExpr>(currentSubExpr);
const CXXConstructExpr *constructorCall =
dyn_cast<CXXConstructExpr>(currentSubExpr);
const auto *variableReference = dyn_cast<DeclRefExpr>(currentSubExpr);
const auto *constructorCall = dyn_cast<CXXConstructExpr>(currentSubExpr);
// If we have a DeclRefExpr, we flag for emitting a diagnosis message in
// case the referenced variable is neither a function parameter nor a
// variable declared in the catch statement.

View File

@ -26,7 +26,7 @@ const char CastSequence[] = "sequence";
AST_MATCHER(Type, sugaredNullptrType) {
const Type *DesugaredType = Node.getUnqualifiedDesugaredType();
if (const BuiltinType *BT = dyn_cast<BuiltinType>(DesugaredType))
if (const auto *BT = dyn_cast<BuiltinType>(DesugaredType))
return BT->getKind() == BuiltinType::NullPtr;
return false;
}
@ -188,7 +188,7 @@ public:
// Only VisitStmt is overridden as we shouldn't find other base AST types
// within a cast expression.
bool VisitStmt(Stmt *S) {
CastExpr *C = dyn_cast<CastExpr>(S);
auto *C = dyn_cast<CastExpr>(S);
// Catch the castExpr inside cxxDefaultArgExpr.
if (auto *E = dyn_cast<CXXDefaultArgExpr>(S))
C = dyn_cast<CastExpr>(E->getExpr());

View File

@ -60,7 +60,7 @@ static StringRef GetText(const Token &Tok, const SourceManager &Sources) {
}
void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) {
const FunctionDecl *Method = Result.Nodes.getNodeAs<FunctionDecl>("method");
const auto *Method = Result.Nodes.getNodeAs<FunctionDecl>("method");
const SourceManager &Sources = *Result.SourceManager;
assert(Method != nullptr);

View File

@ -243,7 +243,7 @@ void TypeMismatchCheck::registerMatchers(MatchFinder *Finder) {
void TypeMismatchCheck::check(const MatchFinder::MatchResult &Result) {
static ento::mpi::MPIFunctionClassifier FuncClassifier(*Result.Context);
const CallExpr *const CE = Result.Nodes.getNodeAs<CallExpr>("CE");
const auto *const CE = Result.Nodes.getNodeAs<CallExpr>("CE");
if (!CE->getDirectCallee())
return;

View File

@ -102,7 +102,7 @@ bool areParensNeededForOverloadedOperator(OverloadedOperatorKind OperatorKind) {
}
bool areParensNeededForStatement(const Stmt *Statement) {
if (const CXXOperatorCallExpr *OverloadedOperatorCall =
if (const auto *OverloadedOperatorCall =
llvm::dyn_cast<CXXOperatorCallExpr>(Statement)) {
return areParensNeededForOverloadedOperator(
OverloadedOperatorCall->getOperator());

View File

@ -57,7 +57,7 @@ static std::string getNamespaceComment(const NamespaceDecl *ND,
}
void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
const NamespaceDecl *ND = Result.Nodes.getNodeAs<NamespaceDecl>("namespace");
const auto *ND = Result.Nodes.getNodeAs<NamespaceDecl>("namespace");
const SourceManager &Sources = *Result.SourceManager;
if (!locationsInSameFile(Sources, ND->getLocStart(), ND->getRBraceLoc()))

View File

@ -24,7 +24,7 @@ void RedundantDeclarationCheck::registerMatchers(MatchFinder *Finder) {
}
void RedundantDeclarationCheck::check(const MatchFinder::MatchResult &Result) {
const NamedDecl *D = Result.Nodes.getNodeAs<NamedDecl>("Decl");
const auto *D = Result.Nodes.getNodeAs<NamedDecl>("Decl");
const auto *Prev = D->getPreviousDecl();
if (!Prev)
return;

View File

@ -116,8 +116,8 @@ void RedundantSmartptrGetCheck::check(const MatchFinder::MatchResult &Result) {
bool IsPtrToPtr = Result.Nodes.getNodeAs<Decl>("ptr_to_ptr") != nullptr;
bool IsMemberExpr = Result.Nodes.getNodeAs<Expr>("memberExpr") != nullptr;
const Expr *GetCall = Result.Nodes.getNodeAs<Expr>("redundant_get");
const Expr *Smartptr = Result.Nodes.getNodeAs<Expr>("smart_pointer");
const auto *GetCall = Result.Nodes.getNodeAs<Expr>("redundant_get");
const auto *Smartptr = Result.Nodes.getNodeAs<Expr>("smart_pointer");
if (IsPtrToPtr && IsMemberExpr) {
// Ignore this case (eg. Foo->get()->DoSomething());

View File

@ -211,7 +211,7 @@ void FindAllSymbols::run(const MatchFinder::MatchResult &Result) {
return;
}
const NamedDecl *ND = Result.Nodes.getNodeAs<NamedDecl>("decl");
const auto *ND = Result.Nodes.getNodeAs<NamedDecl>("decl");
assert(ND && "Matched declaration must be a NamedDecl!");
const SourceManager *SM = Result.SourceManager;

View File

@ -225,8 +225,7 @@ bool CoverageChecker::collectModuleHeaders(const Module &Mod) {
ModuleMapHeadersSet.insert(ModularizeUtilities::getCanonicalPath(
Header.Entry->getName()));
for (Module::submodule_const_iterator MI = Mod.submodule_begin(),
MIEnd = Mod.submodule_end();
for (auto MI = Mod.submodule_begin(), MIEnd = Mod.submodule_end();
MI != MIEnd; ++MI)
collectModuleHeaders(**MI);

View File

@ -341,9 +341,7 @@ static std::string findInputFile(const CommandLineArguments &CLArgs) {
const unsigned IncludedFlagsBitmask = options::CC1Option;
unsigned MissingArgIndex, MissingArgCount;
SmallVector<const char *, 256> Argv;
for (CommandLineArguments::const_iterator I = CLArgs.begin(),
E = CLArgs.end();
I != E; ++I)
for (auto I = CLArgs.begin(), E = CLArgs.end(); I != E; ++I)
Argv.push_back(I->c_str());
InputArgList Args = Opts->ParseArgs(Argv, MissingArgIndex, MissingArgCount,
IncludedFlagsBitmask);

View File

@ -77,7 +77,7 @@ ModularizeUtilities *ModularizeUtilities::createModularizeUtilities(
std::error_code ModularizeUtilities::loadAllHeaderListsAndDependencies() {
typedef std::vector<std::string>::iterator Iter;
// For each input file.
for (Iter I = InputFilePaths.begin(), E = InputFilePaths.end(); I != E; ++I) {
for (auto I = InputFilePaths.begin(), E = InputFilePaths.end(); I != E; ++I) {
llvm::StringRef InputPath = *I;
// If it's a module map.
if (InputPath.endswith(".modulemap")) {
@ -345,8 +345,7 @@ bool ModularizeUtilities::collectModuleHeaders(const clang::Module &Mod) {
DependentsVector UmbrellaDependents;
// Recursively do submodules.
for (clang::Module::submodule_const_iterator MI = Mod.submodule_begin(),
MIEnd = Mod.submodule_end();
for (auto MI = Mod.submodule_begin(), MIEnd = Mod.submodule_end();
MI != MIEnd; ++MI)
collectModuleHeaders(**MI);

View File

@ -87,17 +87,14 @@ bool Module::output(llvm::raw_fd_ostream &OS, int Indent) {
}
// Output submodules.
for (std::vector<Module *>::iterator I = SubModules.begin(),
E = SubModules.end();
I != E; ++I) {
for (auto I = SubModules.begin(), E = SubModules.end(); I != E; ++I) {
if (!(*I)->output(OS, Indent))
return false;
}
// Output header files.
for (std::vector<std::string>::iterator I = HeaderFileNames.begin(),
E = HeaderFileNames.end();
I != E; ++I) {
for (auto I = HeaderFileNames.begin(), E = HeaderFileNames.end(); I != E;
++I) {
OS.indent(Indent);
if (IsProblem || strstr((*I).c_str(), ".inl"))
OS << "exclude header \"" << *I << "\"\n";
@ -123,9 +120,7 @@ bool Module::output(llvm::raw_fd_ostream &OS, int Indent) {
// Lookup a sub-module.
Module *Module::findSubModule(llvm::StringRef SubName) {
for (std::vector<Module *>::iterator I = SubModules.begin(),
E = SubModules.end();
I != E; ++I) {
for (auto I = SubModules.begin(), E = SubModules.end(); I != E; ++I) {
if ((*I)->Name == SubName)
return *I;
}
@ -227,7 +222,7 @@ static Module *loadModuleDescriptions(
DependencyMap &Dependencies, llvm::StringRef HeaderPrefix) {
// Create root module.
Module *RootModule = new Module(RootModuleName, false);
auto *RootModule = new Module(RootModuleName, false);
llvm::SmallString<256> CurrentDirectory;
llvm::sys::fs::current_path(CurrentDirectory);

View File

@ -558,9 +558,7 @@ public:
// Check for the presence of a header inclusion path handle entry.
// Return false if not found.
bool haveInclusionPathHandle(InclusionPathHandle H) {
for (std::vector<InclusionPathHandle>::iterator
I = InclusionPathHandles.begin(),
E = InclusionPathHandles.end();
for (auto I = InclusionPathHandles.begin(), E = InclusionPathHandles.end();
I != E; ++I) {
if (*I == H)
return true;
@ -608,8 +606,7 @@ public:
MacroExpansionInstance *
findMacroExpansionInstance(StringHandle MacroExpanded,
PPItemKey &DefinitionLocation) {
for (std::vector<MacroExpansionInstance>::iterator
I = MacroExpansionInstances.begin(),
for (auto I = MacroExpansionInstances.begin(),
E = MacroExpansionInstances.end();
I != E; ++I) {
if ((I->MacroExpanded == MacroExpanded) &&
@ -659,9 +656,7 @@ public:
// Check for the presence of a header inclusion path handle entry.
// Return false if not found.
bool haveInclusionPathHandle(InclusionPathHandle H) {
for (std::vector<InclusionPathHandle>::iterator
I = InclusionPathHandles.begin(),
E = InclusionPathHandles.end();
for (auto I = InclusionPathHandles.begin(), E = InclusionPathHandles.end();
I != E; ++I) {
if (*I == H)
return true;
@ -701,8 +696,7 @@ public:
// Find a matching condition expansion instance.
ConditionalExpansionInstance *
findConditionalExpansionInstance(clang::PPCallbacks::ConditionValueKind ConditionValue) {
for (std::vector<ConditionalExpansionInstance>::iterator
I = ConditionalExpansionInstances.begin(),
for (auto I = ConditionalExpansionInstances.begin(),
E = ConditionalExpansionInstances.end();
I != E; ++I) {
if (I->ConditionValue == ConditionValue) {
@ -954,9 +948,8 @@ public:
HeaderHandle findHeaderHandle(llvm::StringRef HeaderPath) const {
std::string CanonicalPath = getCanonicalPath(HeaderPath);
HeaderHandle H = 0;
for (std::vector<StringHandle>::const_iterator I = HeaderPaths.begin(),
E = HeaderPaths.end();
I != E; ++I, ++H) {
for (auto I = HeaderPaths.begin(), E = HeaderPaths.end(); I != E;
++I, ++H) {
if (**I == CanonicalPath)
return H;
}
@ -1004,9 +997,7 @@ public:
// Check for presence of header handle in the header stack.
bool isHeaderHandleInStack(HeaderHandle H) const {
for (std::vector<HeaderHandle>::const_iterator I = HeaderStack.begin(),
E = HeaderStack.end();
I != E; ++I) {
for (auto I = HeaderStack.begin(), E = HeaderStack.end(); I != E; ++I) {
if (*I == H)
return true;
}
@ -1018,10 +1009,8 @@ public:
InclusionPathHandle
findInclusionPathHandle(const std::vector<HeaderHandle> &Path) const {
InclusionPathHandle H = 0;
for (std::vector<HeaderInclusionPath>::const_iterator
I = InclusionPaths.begin(),
E = InclusionPaths.end();
I != E; ++I, ++H) {
for (auto I = InclusionPaths.begin(), E = InclusionPaths.end(); I != E;
++I, ++H) {
if (I->Path == Path)
return H;
}
@ -1065,7 +1054,7 @@ public:
StringHandle MacroName = addString(II->getName());
PPItemKey InstanceKey(PP, MacroName, H, InstanceLoc);
PPItemKey DefinitionKey(PP, MacroName, H, DefinitionLoc);
MacroExpansionMapIter I = MacroExpansions.find(InstanceKey);
auto I = MacroExpansions.find(InstanceKey);
// If existing instance of expansion not found, add one.
if (I == MacroExpansions.end()) {
std::string InstanceSourceLine =
@ -1113,7 +1102,7 @@ public:
return;
StringHandle ConditionUnexpandedHandle(addString(ConditionUnexpanded));
PPItemKey InstanceKey(PP, ConditionUnexpandedHandle, H, InstanceLoc);
ConditionalExpansionMapIter I = ConditionalExpansions.find(InstanceKey);
auto I = ConditionalExpansions.find(InstanceKey);
// If existing instance of condition not found, add one.
if (I == ConditionalExpansions.end()) {
std::string InstanceSourceLine =
@ -1144,9 +1133,8 @@ public:
bool reportInconsistentMacros(llvm::raw_ostream &OS) override {
bool ReturnValue = false;
// Walk all the macro expansion trackers in the map.
for (MacroExpansionMapIter I = MacroExpansions.begin(),
E = MacroExpansions.end();
I != E; ++I) {
for (auto I = MacroExpansions.begin(), E = MacroExpansions.end(); I != E;
++I) {
const PPItemKey &ItemKey = I->first;
MacroExpansionTracker &MacroExpTracker = I->second;
// If no mismatch (only one instance value) continue.
@ -1162,8 +1150,7 @@ public:
<< "' has different values in this header, depending on how it was "
"included.\n";
// Walk all the instances.
for (std::vector<MacroExpansionInstance>::iterator
IMT = MacroExpTracker.MacroExpansionInstances.begin(),
for (auto IMT = MacroExpTracker.MacroExpansionInstances.begin(),
EMT = MacroExpTracker.MacroExpansionInstances.end();
IMT != EMT; ++IMT) {
MacroExpansionInstance &MacroInfo = *IMT;
@ -1171,12 +1158,11 @@ public:
<< *MacroInfo.MacroExpanded
<< "' with respect to these inclusion paths:\n";
// Walk all the inclusion path hierarchies.
for (std::vector<InclusionPathHandle>::iterator
IIP = MacroInfo.InclusionPathHandles.begin(),
for (auto IIP = MacroInfo.InclusionPathHandles.begin(),
EIP = MacroInfo.InclusionPathHandles.end();
IIP != EIP; ++IIP) {
const std::vector<HeaderHandle> &ip = getInclusionPath(*IIP);
int Count = (int)ip.size();
auto Count = (int)ip.size();
for (int Index = 0; Index < Count; ++Index) {
HeaderHandle H = ip[Index];
OS << std::string((Index * 2) + 4, ' ') << *getHeaderFilePath(H)
@ -1205,7 +1191,7 @@ public:
bool reportInconsistentConditionals(llvm::raw_ostream &OS) override {
bool ReturnValue = false;
// Walk all the conditional trackers in the map.
for (ConditionalExpansionMapIter I = ConditionalExpansions.begin(),
for (auto I = ConditionalExpansions.begin(),
E = ConditionalExpansions.end();
I != E; ++I) {
const PPItemKey &ItemKey = I->first;
@ -1225,8 +1211,7 @@ public:
<< "' has different values in this header, depending on how it was "
"included.\n";
// Walk all the instances.
for (std::vector<ConditionalExpansionInstance>::iterator
IMT = CondTracker.ConditionalExpansionInstances.begin(),
for (auto IMT = CondTracker.ConditionalExpansionInstances.begin(),
EMT = CondTracker.ConditionalExpansionInstances.end();
IMT != EMT; ++IMT) {
ConditionalExpansionInstance &MacroInfo = *IMT;
@ -1234,12 +1219,11 @@ public:
<< ConditionValueKindStrings[MacroInfo.ConditionValue]
<< "' with respect to these inclusion paths:\n";
// Walk all the inclusion path hierarchies.
for (std::vector<InclusionPathHandle>::iterator
IIP = MacroInfo.InclusionPathHandles.begin(),
for (auto IIP = MacroInfo.InclusionPathHandles.begin(),
EIP = MacroInfo.InclusionPathHandles.end();
IIP != EIP; ++IIP) {
const std::vector<HeaderHandle> &ip = getInclusionPath(*IIP);
int Count = (int)ip.size();
auto Count = (int)ip.size();
for (int Index = 0; Index < Count; ++Index) {
HeaderHandle H = ip[Index];
OS << std::string((Index * 2) + 4, ' ') << *getHeaderFilePath(H)

View File

@ -161,8 +161,7 @@ static int outputPPTrace(std::vector<CallbackCall> &CallbackCalls,
const CallbackCall &Callback = *I;
OS << "- Callback: " << Callback.Name << "\n";
for (std::vector<Argument>::const_iterator AI = Callback.Arguments.begin(),
AE = Callback.Arguments.end();
for (auto AI = Callback.Arguments.begin(), AE = Callback.Arguments.end();
AI != AE; ++AI) {
const Argument &Arg = *AI;
OS << " " << Arg.Name << ": " << Arg.Value << "\n";

View File

@ -14,7 +14,7 @@ public:
Finder->addMatcher(ast_matchers::varDecl().bind("var"), this);
}
void check(const ast_matchers::MatchFinder::MatchResult &Result) override {
const VarDecl *Var = Result.Nodes.getNodeAs<VarDecl>("var");
const auto *Var = Result.Nodes.getNodeAs<VarDecl>("var");
// Add diagnostics in the wrong order.
diag(Var->getLocation(), "variable");
diag(Var->getTypeSpecStartLoc(), "type specifier");

View File

@ -31,8 +31,7 @@ public:
if (!Aliaser)
Aliaser.reset(new NamespaceAliaser(*Result.SourceManager));
const CallExpr *Call =
Result.Nodes.getNodeAs<CallExpr>("foo");
const auto *Call = Result.Nodes.getNodeAs<CallExpr>("foo");
assert(Call != nullptr && "Did not find node \"foo\"");
auto Hint = Aliaser->createAlias(*Result.Context, *Call, "::foo::bar",
{"b", "some_alias"});

View File

@ -33,8 +33,7 @@ public:
if (!Inserter)
Inserter.reset(new UsingInserter(*Result.SourceManager));
const clang::CallExpr *Call =
Result.Nodes.getNodeAs<clang::CallExpr>("foo");
const auto *Call = Result.Nodes.getNodeAs<clang::CallExpr>("foo");
assert(Call != nullptr && "Did not find node \"foo\"");
auto Hint =
Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func");