VS有一个不错的 clang插件,它支持代码格式化。很好,但它打破了所有复杂的定义:
假设我们有:
#include <boost/preprocessor.hpp>
#include <boost/shared_ptr.hpp>
#define NM_PP_VARIADIC_MAX_LENGTH 5
#define NM_PP_TYPE_DECL(z, n, T) \
class BOOST_PP_CAT(T, n )
#define NM_PP_TYPE(z, n, T) \
BOOST_PP_CAT(T, n )
#define NM_PP_ARGUMENT_DECL(z, n, T) \
BOOST_PP_CAT(T, n ) BOOST_PP_CAT(t, n )
这是我们在格式化后得到的:
#include <boost/preprocessor.hpp>
#include <boost/shared_ptr.hpp>
#define NM_PP_VARIADIC_MAX_LENGTH 5
#define NM_PP_TYPE_DECL(z, n, T) \
class BOOST_PP_CAT(T, n)
#define NM_PP_TYPE(z, n, T)
BOOST_PP_CAT(T, n)
#define NM_PP_ARGUMENT_DECL(z, n, T)
BOOST_PP_CAT(T, n) BOOST_PP_CAT(t, n)
如您所见,此类代码将无法编译,并且大部分\
已被删除。有没有办法将其配置为不删除\
?
我尝试使用 LLVM 之类的默认配置并查看了格式化参数,但我看不到这种残酷的代码优化是在哪里定义的。