[llvm-bugs] [Bug 44473] New: Different behavior for #include when using -iquote with/without header maps

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 6 09:45:30 PST 2020


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

            Bug ID: 44473
           Summary: Different behavior for #include when using -iquote
                    with/without header maps
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 6f6231 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

When using the -iquote flag to clang, the behavior of an #include directive is
different if the argument passed is a directory or a header map.

This works as expected:

$ cat test.c
#include "foo.h"

int bar() { return foo(); }
$ cat some/include/path/foo.h
int foo(void);
$ clang -c -iquote some/include/path test.c
$

However, if foo.h comes via a header map:

$ ~/bin/hmapdump headers.hmap
Header:
Magic: hmap
Version: 1
Reserved: 0
StringsOffset: 72
NumEntries: 3
NumBuckets: 4
MaxValueLength: 23
Buckets:
0: empty
1: empty
2: 1 7 26
3: empty
StringsTable:
0:
1: foo.h
7: some/include/path/
26: foo.h
Entries:
[2] 'foo.h' -> 'some/include/path/' 'foo.h'
$ clang -c -iquote headers.hmap test.c
test.c:1:10: fatal error: 'foo.h' file not found
#include "foo.h"
         ^~~~~~~
1 error generated.

Is this by design or is it a bug?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200106/f99334a7/attachment.html>


More information about the llvm-bugs mailing list