Most modern libraries and applications include files with relative paths from a root (e.g. #include <foo/bar/baz.h> versus #include "baz.h".) When regrouping, a file's "main include" should be left at the top (given priority 0.) The existing IncludeCategoryManager::isMainHeader() checks only the file stem (e.g. baz.h), and fails to identify main includes with angle brackets despite a comment saying // remove the surrounding "" or <>.
This patch fixes these issues by comparing all directory components present in both the #include string and the file name, and by allowing angle bracket includes to be considered "main". It adds a new IsMainHeader unit test to check behavior of framework-style includes, which would fail without this patch.