[PATCH] D22208: [clang-tidy] Fixes to modernize-use-emplace

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 19:11:38 PDT 2016


Prazek added a comment.

There is one bug left:

In the ClangIncludeFixer.cpp:169 there is push back that looks like this

Symbols.push_back(find_all_symbols::SymbolInfo(

  Split.first.trim(),
  find_all_symbols::SymbolInfo::SymbolKind::Unknown,
  CommaSplits[I].trim(), 1, {}, /*NumOccurrences=*/E - I));

There is initializer list inside that should not allow this to be matched (because I check for initializer list as argument)

Unfortunatelly clang AST doesn't mention any initializer list.

http://wklejto.pl/258691

As you can see the "{}" looks like this in AST

  |-MaterializeTemporaryExpr 0x7f759d803900 <col:39, col:40> 'const std::vector<Context>':'const class std::vector<struct std::pair<enum clang::find_all_symbols::SymbolInfo::ContextType, class std::basic_string<char> >, class std::allocator<struct std::pair<enum clang::find_all_symbols::SymbolInfo::ContextType, class std::basic_string<char> > > >' lvalue
  |   |   |               | `-CXXBindTemporaryExpr 0x7f759d8038e0 <col:39, col:40> 'const std::vector<Context>':'const class std::vector<struct std::pair<enum clang::find_all_symbols::SymbolInfo::ContextType, class std::basic_string<char> >, class std::allocator<struct std::pair<enum clang::find_all_symbols::SymbolInfo::ContextType, class std::basic_string<char> > > >' (CXXTemporary 0x7f759d8038d8)
  |   |   |               |   `-CXXConstructExpr 0x7f759d8038a8 <col:39, col:40> 'const std::vector<Context>':'const class std::vector<struct std::pair<enum clang::find_all_symbols::SymbolInfo::ContextType, class std::basic_string<char> >, class std::allocator<struct std::pair<enum clang::find_all_symbols::SymbolInfo::ContextType, class std::basic_string<char> > > >' 'void (void)'
  |   |   |               

Good news are that this is the only 1 case from all push_backs that it found on LLVM+Clang+extra. This patch fixed the ExprWithCleanups by using ignoreImplicit, so I clang-tidy have many new push_backs.


Repository:
  rL LLVM

https://reviews.llvm.org/D22208





More information about the cfe-commits mailing list