[llvm-bugs] [Bug 39247] New: clang-format FixNamespaceComments damages deprecation macros

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 10 18:28:15 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39247

            Bug ID: 39247
           Summary: clang-format FixNamespaceComments damages deprecation
                    macros
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sfinae at hotmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

clang-format emits a damaged comment:

C:\Temp>type bug.cpp
#define DEPRECATE_WOOF [[deprecated("meow")]]

namespace DEPRECATE_WOOF woof {
    void puppy() {}
}

C:\Temp>clang-format -style=LLVM bug.cpp
#define DEPRECATE_WOOF [[deprecated("meow")]]

namespace DEPRECATE_WOOF woof {
void puppy() {}
} // namespace DEPRECATE_WOOFwoof

MSVC's STL uses macros here to conditionally deprecate namespaces. Directly
using an attribute also results in a dropped space:

C:\Temp>type bug.cpp
namespace [[deprecated("meow")]] woof {
    void puppy() {}
}

C:\Temp>clang-format -style=LLVM bug.cpp
namespace [[deprecated("meow")]] woof {
  void puppy() {}
} // namespace [[deprecated("meow")]]woof

-- 
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/20181011/e65f9c5c/attachment.html>


More information about the llvm-bugs mailing list