[PATCH] D34449: [clang-tidy] Enable constexpr definitions in headers.

2017-06-27 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. BTW, could you please also update the `docs/clang-tidy/checks/misc-definitions-in-headers.rst`? Comment at: test/clang-tidy/misc-definitions-in-headers-1z.hpp:5 +class CE { + constexpr static int i = 5; +}; Could you follow the way of

[PATCH] D34449: [clang-tidy] Enable constexpr definitions in headers.

2017-06-27 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 104111. xazax.hun marked 5 inline comments as done. xazax.hun added a comment. Herald added a subscriber: JDevlieghere. - Updates according to the reviews. https://reviews.llvm.org/D34449 Files: clang-tidy/misc/DefinitionsInHeadersCheck.cpp test/clang

[PATCH] D34449: [clang-tidy] Enable constexpr definitions in headers.

2017-06-22 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. Have thought this a bit more, I misunderstood your patch previously (sorry for that). I think what you intend to do is to ignore C++17 `inline variables` in headers, am I correct? Comment at: test/clang-tidy/misc-definitions-in-headers.hpp:1 -// RUN:

[PATCH] D34449: [clang-tidy] Enable constexpr definitions in headers.

2017-06-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: test/clang-tidy/misc-definitions-in-headers.hpp:1 -// RUN: %check_clang_tidy %s misc-definitions-in-headers %t +// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z The original code should work

[PATCH] D34449: [clang-tidy] Enable constexpr definitions in headers.

2017-06-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: test/clang-tidy/misc-definitions-in-headers.hpp:180 +class CE { + constexpr static int i = 5; // OK: constexpr definition. +}; This is not as safe as you might think. As-is, this is fine, however, if the class is

[PATCH] D34449: [Clang-tidy] Enable constexpr definitions in headers.

2017-06-21 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun created this revision. xazax.hun added a project: clang-tools-extra. Herald added a subscriber: whisperity. Constexpr variable definitions should be ok in headers. https://stackoverflow.com/questions/34445336/constexpr-global-constants-in-a-header-file-and-odr Repository: rL LLVM h