[PATCH] D76071: [Tooling] Recognize angle brackets for main header

Daniele E. Domenichelli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 08:40:56 PDT 2020


drdanz created this revision.
drdanz added a reviewer: ioeric.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

clang-format does not recognize as main header an include that uses
angle brackets. This is a common practice used in many projects.

This patch removes the initial check for the '"' character.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76071

Files:
  clang/lib/Tooling/Inclusions/HeaderIncludes.cpp


Index: clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
===================================================================
--- clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
+++ clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
@@ -219,8 +219,6 @@
   return Ret;
 }
 bool IncludeCategoryManager::isMainHeader(StringRef IncludeName) const {
-  if (!IncludeName.startswith("\""))
-    return false;
   StringRef HeaderStem =
       llvm::sys::path::stem(IncludeName.drop_front(1).drop_back(1));
   if (FileStem.startswith(HeaderStem) ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76071.249949.patch
Type: text/x-patch
Size: 534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200312/76451f68/attachment.bin>


More information about the cfe-commits mailing list