]> granicus.if.org Git - clang/commit
[clang-format] Allow configuring list of function-like macros that resolve to a type
authorFrancois Ferrand <thetypz@gmail.com>
Wed, 29 May 2019 16:30:47 +0000 (16:30 +0000)
committerFrancois Ferrand <thetypz@gmail.com>
Wed, 29 May 2019 16:30:47 +0000 (16:30 +0000)
commit5f069d77071caa8ed9091f216f852f0c747eb87a
tree88d0586bad7686a895262449c51ad27cf5d0b9b6
parentb9514dcd324aeb269cd94ebda05e7ecb474b89a6
[clang-format] Allow configuring list of function-like macros that resolve to a type

Summary:
Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way similar to `typeof()`.

This is enough to:
- Prevent misinterpreting declarations of pointers to such types as expressions (`STACK_OF(int) * foo` -> `STACK_OF(int) *foo`),
- Avoid surprising line breaks in variable/struct field declarations (`STACK_OF(int)\nfoo;` -> `STACK_OF(int) foo;`, see https://bugs.llvm.org/show_bug.cgi?id=30353).

Reviewers: Typz, krasimir, djasper

Reviewed By: Typz

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57184

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361986 91177308-0d34-0410-b5e6-96231b3b80d8
docs/ClangFormatStyleOptions.rst
include/clang/Format/Format.h
lib/Format/Format.cpp
lib/Format/FormatToken.h
lib/Format/FormatTokenLexer.cpp
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp