Skip to content

NumQuoted wrong after RemoveDuplicates(SearchList, NumQuoted, Verbose); #11469

@llvmbot

Description

@llvmbot
Bugzilla Link 11097
Resolution FIXED
Resolved on Oct 11, 2011 00:03
Version trunk
OS Linux
Attachments Patch to fix 11097
Reporter LLVM Bugzilla Contributor
CC @efriedma-quic

Extended Description

In InitHeaderSearch.cpp in the Realize() method during the third call
to RemoveDuplicates:

01092 // Remove duplicates across both the Angled and System
directories. GCC does
01093 // this and failing to remove duplicates across these two groups breaks
01094 // #include_next.
01095 RemoveDuplicates(SearchList, NumQuoted, Verbose);

The RemoveDuplicates method can remove non system directories (when
they are also system directories) showing the information message:

01039 if (DirToRemove != i)
01040 llvm::errs() << " as it is a non-system directory that
duplicates "
01041 << "a system directory\n";

When this happens, the NumQuoted variable is wrong, the header
initialization is incorrect:
01098 Headers.SetSearchPaths(SearchList, NumQuoted, NumAngled,
DontSearchCurDir);

and the use of search_dir_iterator system_dir_begin() is unreliable,
missing some system directories.

This bug manifested itself using include-what-you-use, misinterpreting some system path as user path:
http://code.google.com/p/include-what-you-use/issues/detail?id=60

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:headersHeaders provided by Clang, e.g. for intrinsics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions