[PATCH] D144884: [clang-format] Only add pragma continuation indentation for 'omp' clauses

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 11:51:11 PST 2023


jhuber6 added inline comments.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1279
+  if (State.Line->InPragmaDirective) {
+    FormatToken *PragmaType = State.Line->First->Next->Next;
+    if (PragmaType && PragmaType->TokenText.equals("omp"))
----------------
HazardyKnusperkeks wrote:
> Do we know that the first `Next` is never null?
The line should only have `InPragmaDirective` if it found `pragma`, so it should look something like this if you go through the tokens. I checked the final `Next` because someone could do `#pragma`.
```
#
pragma
comment
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144884/new/

https://reviews.llvm.org/D144884



More information about the cfe-commits mailing list