Skip to content

Include MainRegex not working with <...> #37620

Open
@llvmbot

Description

@llvmbot
Bugzilla Link 38272
Version trunk
OS Windows NT
Attachments format settings
Reporter LLVM Bugzilla Contributor

Extended Description

Having the following includes in a File "BTest.h" :

#include "StdAfx.h"
#include <BTest.h> /// MAIN INCLUDE
#include <ATest.h>  

and the attached clang-format rules: excerpt here:

IncludeCategories: 
  - Regex:           '^[<"]StdAfx'
    Priority:        -1
  - Regex:           '^<.*>'
    Priority:        2
  - Regex:           '.*'
    Priority:        3
IncludeIsMainRegex: '$'

The output sorts like:

#include "StdAfx.h"
#include <ATest.h>
#include <BTest.h>  /// MAIN INCLUDE

which is kind of wrong (even though normally we would use quotes "" instead of angles <> for the main include).

This only happens with "<BTest.h>" not with with the quotes: '"BTest.h"'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions