[PATCH] D92753: [clang-format] Add IndentPragma style to eliminate common clang-format off scenario
Tobias Nöll via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 7 07:38:29 PST 2021
RatTac reopened this revision.
RatTac added a comment.
This revision is now accepted and ready to land.
This is a great feature. However I found two issues:
First issue is with combination of IndentPPDirectives
// IndentPPDirectives: BeforeHash
// IndentPragmas: true
#if defined(WIN32)
#define TEST // Correctly indented because IndentPPDirectives: BeforeHash
#endif
#if defined(WIN32)
#pragma warning(disable : 4005) // NOT indented even though IndentPPDirectives: BeforeHash
#endif
Second issue is with combination of lambda function:
inline void ompExecuteParallel(unsigned int endIndex, const std::function<void(unsigned int i)>& computeFunction, unsigned int startIdx)
{
#pragma omp parallel for
for(int i = (int)startIdx; i < (int)endIndex; i++)
computeFunction(i);
}
int main()
{
#pragma omp parallel for
for(int i = 0; i < 10; i++)
{
// Correctly indented because IndentPragmas: true
#pragma openmp critical
{
std::cout << i << endl;
}
}
ompExecuteParallel(10, [&](unsigned int i) {
#pragma openmp critical // Incorrectly indented even though IndentPragmas: true
{
std::cout << i << endl;
}
});
return 0;
}
Hope this is the right place to raise concerns...
Regards
Tobias
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92753/new/
https://reviews.llvm.org/D92753
More information about the cfe-commits
mailing list