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

            Bug ID: 48899
           Summary: Constructor annotations are moved on a newline for
                    classes with uppercase names
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: mar...@dreamer-ge.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

There seems to be a difference in the behavior for constructor annotations when
then class name is fully uppercase vs mixed case.

Style:
---
Language:        Cpp
ColumnLimit: 0
...

Example:
class AABB
{
    AABB(const Vector&) noexcept;
};
class Aabb
{
    Aabb(const Vector&) noexcept;
};

Formatted:
class AABB
{
    AABB(const Vector&)
    noexcept; // <- annotation got moved to the next line
};
class Aabb
{
    Aabb(const Vector&) noexcept; //<- annotation remained in place
};

Upon investigating I reached two code locations:

https://github.com/llvm/llvm-project/blob/3e206a5922c18392353ba24e80339301183f679d/clang/lib/Format/UnwrappedLineParser.cpp#L1464

UnwrappedLineParser.cpp#L1464 - seems to treat all uppercase function names as
macros and adds an unwrapped line before processing of annotations

https://github.com/llvm/llvm-project/blob/412ac0e53688364fe1295e864abd53e104eeb554/clang/lib/Format/TokenAnnotator.cpp#L1686

TokenAnnotator.cpp#L1686 - for some reason the logic here is reversed and tags
annotation are only processed when the function name is uppercase

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to