[PATCH] D104222: [clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace

Francois JEAN via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 15 06:58:33 PDT 2021


Wawha added a comment.

Hi @christophe-calmejane.
I test your code with a old version (few time after the merge of https://reviews.llvm.org/D44609), and the latest version (commit: e0c382a9d5a0 <https://reviews.llvm.org/rGe0c382a9d5a0e2689b97186736ebc82e17c5f822>), and in both cases I have the same result, which is near your output:

  noOtherParams(
  	[](int x)
  	{
  		call();
  	});
  paramBeforeLambda(
  	8,
  	[](int x)
  	{
  		call();
  	});
  paramAfterLambda(
  	[](int x)
  	{
  		call();
  	},
  	5);
  paramBeforeAndAfterLambda(
  	8,
  	[](int x)
  	{
  		call();
  	},
  	5);
  doubleLambda(
  	8,
  	[](int x)
  	{
  		call();
  	},
  	6,
  	[](float f)
  	{
  		return f * 2;
  	},
  	5);
  nestedLambda1(
  	[](int x)
  	{
  		return [](float f)
  		{
  			return f * 2;
  		};
  	});
  nestedLambda2(
  	[](int x)
  	{
  		call(
  			[](float f)
  			{
  				return f * 2;
  			});
  	});
  noExceptCall(
  	[](int x) noexcept
  	{
  		call();
  	});
  mutableCall(
  	[](int x) mutable
  	{
  		call();
  	});
  
  funcCallFunc(
  	call(),
  	[](int x)
  	{
  		call();
  	});
  
  auto const l = [](char v)
  {
  	if(v)
  		call();
  };
  void f()
  {
  	return [](char v)
  	{
  		if(v)
  			return v++;
  	};
  }

The only different is for cases with multiples parameters.

  paramBeforeLambda(
  	8,
  	[](int x)
  	{
  		call();
  	}

I though I add multiples cases, but looking at UnitTests with inline lambda "None", I see only few tests, perhaps some are missing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104222/new/

https://reviews.llvm.org/D104222



More information about the cfe-commits mailing list