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

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


Prazek added inline comments.

================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:112
@@ -95,1 +111,3 @@
+  auto CtorCallSourceRange = CharSourceRange::getTokenRange(
+      InnerCtorCall->getExprLoc(), CallParensRange.getBegin());
 
----------------
alexfh wrote:
> > There is a bug here that I forgot about. Should be InnerCtorCall->getStartLoc()
> 
> Is this still relevant?
The thing is, that I have no idea. So I was expecting this to happen when I will run on llvm code base, but it seems that it works I don't know why.

So firstly, I marked wrong line, because I think the problem might be in line 94 (Call->getArg(0)->getExprLoc() should be ->getLocStart())

So what I was expecting that if The Call->getArg(0) will be a memberExpr (call to member function) then getExprLoc will point to dot instead of the beggining of argument, so
we would remove a object name like

v.push_back(obj.member());
into
v.emplace_back(member());

But I have no idea why I can't find it, and right now I don't know if it is a real bug or not, but it should be if I got a bug here
https://reviews.llvm.org/D21642

Do you have any thoughts/test case that would break it?


Repository:
  rL LLVM

https://reviews.llvm.org/D22208





More information about the cfe-commits mailing list