This is an archive of the discontinued LLVM Phabricator instance.

Fixing issue where a space was not added before a global namespace variable when SpacesInParentheses is set
AcceptedPublic

Authored by dpayne on Mar 1 2018, 10:18 AM.

Details

Reviewers
djasper
Summary

When SpacesInParentheses is set to true clang-format does not add a space before a global namespace variable. For example this is the output of clang-format for a somewhat contrived exampled.

#include <iostream>

void print_val( std::ostream &s ) { s << "Hello world" << std::endl; }

int main( void ) {
  print_val(::std::cout );
  return 0;
}

The .clang-format looked like

Language:        Cpp
SpacesInParentheses: true

Diff Detail

Repository
rC Clang

Event Timeline

dpayne created this revision.Mar 1 2018, 10:18 AM
dpayne updated this revision to Diff 139212.Mar 20 2018, 3:40 PM

Adding a unit test for formatting a global namespace var with SpacesInParentheses enabled.

djasper accepted this revision.Mar 21 2018, 5:25 AM

Please generally upload diffs with the full file as context so that Phabricator can properly expand the context where necessary.

This looks good, though.

This revision is now accepted and ready to land.Mar 21 2018, 5:25 AM

I'll make sure to do the full diff in the future. I did that for the first patch but forgot to do it in the follow up patch, I won't make that mistake in the future.

I do not have commit access so I cannot merge myself. When you have the time could you merge this change?

dpayne added a comment.Apr 6 2018, 6:26 PM

Hi

Bumping this commit. I do not have commit access so I cannot merge myself, if you have the time could you merge this commit?