[llvm-bugs] [Bug 44237] New: cleanupAroundReplacements should insert #include directives after #pragma once

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 6 04:24:36 PST 2019


            Bug ID: 44237
           Summary: cleanupAroundReplacements should insert #include
                    directives after #pragma once
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: igor.bronstein at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Our tool uses clang::format::cleanupAroundReplacements() to insert #include
directives to generated replacements. I can see the following inconsistent
logic: if we try insert #include directives to a header file with a header
guard (#ifndef #define), the directive will be correctly inserted after the
guard. However this logic doesn't apply to #pragma once. The #include
directives will be inserted before the #pragma. This looks wrong for us.

#pragma once should be treated as a header guard in this usecase.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191206/b2a62fb7/attachment.html>

More information about the llvm-bugs mailing list