@@ -165,6 +165,12 @@ Parser::Parser(CppParserOptions* Opts)
165
165
{
166
166
supportedStdTypes.insert (" allocator" );
167
167
supportedStdTypes.insert (" basic_string" );
168
+
169
+ walkedNamespaces.reserve (8192 );
170
+ walkedTypeTemplateParameters.reserve (8192 );
171
+ walkedTemplateTemplateParameters.reserve (32 );
172
+ walkedNonTypeTemplateParameters.reserve (1024 );
173
+ walkedParameters.reserve (65536 );
168
174
}
169
175
170
176
LayoutField Parser::WalkVTablePointer (Class* Class,
@@ -424,27 +430,23 @@ void Parser::Setup(bool Compile)
424
430
if (opts->verbose )
425
431
HSOpts.Verbose = true ;
426
432
427
- for (unsigned I = 0 , E = opts->IncludeDirs . size (); I != E; ++I )
433
+ for (const auto & s : opts->IncludeDirs )
428
434
{
429
- const auto & s = opts->IncludeDirs [I];
430
435
HSOpts.AddPath (s, frontend::Angled, false , false );
431
436
}
432
437
433
- for (unsigned I = 0 , E = opts->SystemIncludeDirs . size (); I != E; ++I )
438
+ for (const auto & s : opts->SystemIncludeDirs )
434
439
{
435
- const auto & s = opts->SystemIncludeDirs [I];
436
440
HSOpts.AddPath (s, frontend::System, false , false );
437
441
}
438
442
439
- for (unsigned I = 0 , E = opts->Defines . size (); I != E; ++I )
443
+ for (const auto & define : opts->Defines )
440
444
{
441
- const auto & define = opts->Defines [I];
442
445
PPOpts.addMacroDef (define);
443
446
}
444
447
445
- for (unsigned I = 0 , E = opts->Undefines . size (); I != E; ++I )
448
+ for (const auto & undefine : opts->Undefines )
446
449
{
447
- const auto & undefine = opts->Undefines [I];
448
450
PPOpts.addMacroUndef (undefine);
449
451
}
450
452
@@ -480,8 +482,7 @@ void Parser::Setup(bool Compile)
480
482
}
481
483
}
482
484
483
- if (TC)
484
- delete TC;
485
+ delete TC;
485
486
486
487
// Enable preprocessing record.
487
488
PPOpts.DetailedRecord = true ;
@@ -2537,7 +2538,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, bool
2537
2538
EnumDecl* ED = ET->getDecl ();
2538
2539
2539
2540
auto TT = new AST::TagType ();
2540
- TT->declaration = TT-> declaration = WalkDeclaration (ED);
2541
+ TT->declaration = WalkDeclaration (ED);
2541
2542
2542
2543
Ty = TT;
2543
2544
break ;
@@ -4430,8 +4431,8 @@ Declaration* Parser::WalkDeclaration(const clang::Decl* D)
4430
4431
{
4431
4432
auto MD = cast<CXXMethodDecl>(D);
4432
4433
Decl = WalkMethodCXX (MD);
4433
- if (Decl == nullptr )
4434
- return Decl ;
4434
+ if (! Decl)
4435
+ return nullptr ;
4435
4436
4436
4437
auto NS = GetNamespace (MD);
4437
4438
Decl->_namespace = NS;
@@ -4609,7 +4610,7 @@ void Parser::SetupLLVMCodegen()
4609
4610
c->getHeaderSearchOpts (), c->getPreprocessorOpts (),
4610
4611
c->getCodeGenOpts (), *LLVMModule, c->getDiagnostics ()));
4611
4612
4612
- codeGenTypes.reset (new clang::CodeGen::CodeGenTypes (*CGM. get () ));
4613
+ codeGenTypes.reset (new clang::CodeGen::CodeGenTypes (*CGM));
4613
4614
}
4614
4615
4615
4616
bool Parser::SetupSourceFiles (const std::vector<std::string>& SourceFiles,
@@ -4710,7 +4711,7 @@ ParserResult* Parser::Parse(const std::vector<std::string>& SourceFiles)
4710
4711
4711
4712
DiagClient->BeginSourceFile (c->getLangOpts (), &c->getPreprocessor ());
4712
4713
4713
- ParseAST (c->getSema ());
4714
+ ParseAST (c->getSema (), opts-> verbose , opts-> skipFunctionBodies );
4714
4715
4715
4716
DiagClient->EndSourceFile ();
4716
4717
0 commit comments