diff --git a/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp b/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp --- a/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp @@ -67,7 +67,9 @@ // recent enough version of Google Test. llvm::StringRef FileName = PP->getSourceManager().getFilename( MD->getMacroInfo()->getDefinitionLoc()); - ReplacementFound = FileName.endswith("gtest/gtest-typed-test.h") && + SmallString<32> TypedTestFileName("gtest/gtest-typed-test.h"); + llvm::sys::path::make_preferred(TypedTestFileName); + ReplacementFound = FileName.endswith(TypedTestFileName) && PP->getSpelling(MacroNameTok) == "TYPED_TEST_SUITE"; } } @@ -103,7 +105,9 @@ llvm::StringRef FileName = PP->getSourceManager().getFilename( MD.getMacroInfo()->getDefinitionLoc()); - if (!FileName.endswith("gtest/gtest-typed-test.h")) + SmallString<32> TypedTestFileName("gtest/gtest-typed-test.h"); + llvm::sys::path::make_preferred(TypedTestFileName); + if (!FileName.endswith(TypedTestFileName)) return; DiagnosticBuilder Diag = Check->diag(Loc, RenameCaseToSuiteMessage); diff --git a/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp b/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp --- a/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp @@ -61,6 +61,8 @@ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) { SmallString<128> CompilerIncudeDir = StringRef(PP->getHeaderSearchInfo().getHeaderSearchOpts().ResourceDir); + // Canonicalize the path since we will compare to it later. + llvm::sys::path::remove_dots(CompilerIncudeDir); llvm::sys::path::append(CompilerIncudeDir, "include"); PP->addPPCallbacks(std::make_unique( *this, SM, CompilerIncudeDir)); diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp --- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -18,6 +18,672 @@ namespace clangd { namespace { const char IWYUPragma[] = "// IWYU pragma: private, include "; + +const llvm::StringMap *GetHeaderMapping() { + static auto *Mappings = + new std::array, 645>{{ + {"algorithm", ""}, + {"array", ""}, + {"atomic", ""}, + {"backward/auto_ptr.h", ""}, + {"backward/binders.h", ""}, + {"bits/algorithmfwd.h", ""}, + {"bits/alloc_traits.h", ""}, + {"bits/allocated_ptr.h", ""}, + {"bits/allocator.h", ""}, + {"bits/atomic_base.h", ""}, + {"bits/atomic_futex.h", ""}, + {"bits/atomic_lockfree_defines.h", ""}, + {"bits/atomic_word.h", ""}, + {"bits/auxv.h", ""}, + {"bits/basic_file.h", ""}, + {"bits/basic_ios.h", ""}, + {"bits/basic_ios.tcc", ""}, + {"bits/basic_string.h", ""}, + {"bits/basic_string.tcc", ""}, + {"bits/byteswap-16.h", ""}, + {"bits/byteswap.h", ""}, + {"bits/c++allocator.h", ""}, + {"bits/c++config.h", ""}, + {"bits/c++io.h", ""}, + {"bits/c++locale.h", ""}, + {"bits/char_traits.h", ""}, + {"bits/cmathcalls.h", ""}, + {"bits/codecvt.h", ""}, + {"bits/concept_check.h", ""}, + {"bits/confname.h", ""}, + {"bits/cpp_type_traits.h", ""}, + {"bits/cpu_defines.h", ""}, + {"bits/ctype_base.h", ""}, + {"bits/cxxabi_forced.h", ""}, + {"bits/cxxabi_tweaks.h", ""}, + {"bits/deque.tcc", ""}, + {"bits/dirent.h", ""}, + {"bits/dlfcn.h", ""}, + {"bits/elfclass.h", ""}, + {"bits/endian.h", ""}, + {"bits/environments.h", ""}, + {"bits/epoll.h", ""}, + {"bits/errno.h", ""}, + {"bits/error_constants.h", ""}, + {"bits/eventfd.h", ""}, + {"bits/exception.h", ""}, + {"bits/exception_defines.h", ""}, + {"bits/exception_ptr.h", ""}, + {"bits/fcntl-linux.h", ""}, + {"bits/fcntl.h", ""}, + {"bits/fenv.h", ""}, + {"bits/forward_list.h", ""}, + {"bits/forward_list.tcc", ""}, + {"bits/fstream.tcc", ""}, + {"bits/functexcept.h", ""}, + {"bits/functional_hash.h", ""}, + {"bits/gslice.h", ""}, + {"bits/gslice_array.h", ""}, + {"bits/gthr-default.h", ""}, + {"bits/gthr.h", ""}, + {"bits/hash_bytes.h", ""}, + {"bits/hashtable.h", ""}, + {"bits/hashtable_policy.h", ""}, + {"bits/huge_val.h", ""}, + {"bits/huge_valf.h", ""}, + {"bits/huge_vall.h", ""}, + {"bits/in.h", ""}, + {"bits/indirect_array.h", ""}, + {"bits/inf.h", ""}, + {"bits/inotify.h", ""}, + {"bits/invoke.h", ""}, + {"bits/ioctl-types.h", ""}, + {"bits/ioctls.h", ""}, + {"bits/ios_base.h", ""}, + {"bits/ipc.h", ""}, + {"bits/ipctypes.h", ""}, + {"bits/istream.tcc", ""}, + {"bits/link.h", ""}, + {"bits/list.tcc", ""}, + {"bits/local_lim.h", ""}, + {"bits/locale.h", ""}, + {"bits/locale_classes.h", ""}, + {"bits/locale_classes.tcc", ""}, + {"bits/locale_conv.h", ""}, + {"bits/locale_facets.h", ""}, + {"bits/locale_facets.tcc", ""}, + {"bits/locale_facets_nonio.h", ""}, + {"bits/locale_facets_nonio.tcc", ""}, + {"bits/localefwd.h", ""}, + {"bits/mask_array.h", ""}, + {"bits/mathcalls.h", ""}, + {"bits/mathdef.h", ""}, + {"bits/memoryfwd.h", ""}, + {"bits/mman-linux.h", ""}, + {"bits/mman.h", ""}, + {"bits/move.h", ""}, + {"bits/mqueue.h", ""}, + {"bits/msq.h", ""}, + {"bits/nan.h", ""}, + {"bits/nested_exception.h", ""}, + {"bits/netdb.h", ""}, + {"bits/opt_random.h", ""}, + {"bits/os_defines.h", ""}, + {"bits/ostream.tcc", ""}, + {"bits/ostream_insert.h", ""}, + {"bits/param.h", ""}, + {"bits/parse_numbers.h", ""}, + {"bits/poll.h", ""}, + {"bits/posix1_lim.h", ""}, + {"bits/posix2_lim.h", ""}, + {"bits/posix_opt.h", ""}, + {"bits/postypes.h", ""}, + {"bits/predefined_ops.h", ""}, + {"bits/pthreadtypes.h", ""}, + {"bits/ptr_traits.h", ""}, + {"bits/quoted_string.h", ""}, + {"bits/random.h", ""}, + {"bits/random.tcc", ""}, + {"bits/range_access.h", ""}, + {"bits/refwrap.h", ""}, + {"bits/regex.h", ""}, + {"bits/regex_automaton.h", ""}, + {"bits/regex_compiler.h", ""}, + {"bits/regex_constants.h", ""}, + {"bits/regex_cursor.h", ""}, + {"bits/regex_error.h", ""}, + {"bits/regex_executor.h", ""}, + {"bits/regex_grep_matcher.h", ""}, + {"bits/regex_grep_matcher.tcc", ""}, + {"bits/regex_nfa.h", ""}, + {"bits/regex_scanner.h", ""}, + {"bits/resource.h", ""}, + {"bits/sched.h", ""}, + {"bits/select.h", ""}, + {"bits/sem.h", ""}, + {"bits/semaphore.h", ""}, + {"bits/setjmp.h", ""}, + {"bits/shared_ptr.h", ""}, + {"bits/shared_ptr_atomic.h", ""}, + {"bits/shared_ptr_base.h", ""}, + {"bits/shm.h", ""}, + {"bits/sigaction.h", ""}, + {"bits/sigcontext.h", ""}, + {"bits/siginfo.h", ""}, + {"bits/signalfd.h", ""}, + {"bits/signum.h", ""}, + {"bits/sigset.h", ""}, + {"bits/sigstack.h", ""}, + {"bits/sigthread.h", ""}, + {"bits/slice_array.h", ""}, + {"bits/sockaddr.h", ""}, + {"bits/socket.h", ""}, + {"bits/socket_type.h", ""}, + {"bits/sstream.tcc", ""}, + {"bits/stab.def", ""}, + {"bits/stat.h", ""}, + {"bits/statfs.h", ""}, + {"bits/statvfs.h", ""}, + {"bits/std_abs.h", ""}, + {"bits/std_function.h", ""}, + {"bits/std_mutex.h", ""}, + {"bits/stdint-intn.h", ""}, + {"bits/stdint-uintn.h", ""}, + {"bits/stdio_lim.h", ""}, + {"bits/stl_algo.h", ""}, + {"bits/stl_algobase.h", ""}, + {"bits/stl_bvector.h", ""}, + {"bits/stl_construct.h", ""}, + {"bits/stl_deque.h", ""}, + {"bits/stl_function.h", ""}, + {"bits/stl_heap.h", ""}, + {"bits/stl_iterator.h", ""}, + {"bits/stl_iterator_base_funcs.h", ""}, + {"bits/stl_iterator_base_types.h", ""}, + {"bits/stl_list.h", ""}, + {"bits/stl_map.h", ""}, + {"bits/stl_multimap.h", ""}, + {"bits/stl_multiset.h", ""}, + {"bits/stl_numeric.h", ""}, + {"bits/stl_pair.h", ""}, + {"bits/stl_queue.h", ""}, + {"bits/stl_raw_storage_iter.h", ""}, + {"bits/stl_relops.h", ""}, + {"bits/stl_set.h", ""}, + {"bits/stl_stack.h", ""}, + {"bits/stl_tempbuf.h", ""}, + {"bits/stl_tree.h", ""}, + {"bits/stl_uninitialized.h", ""}, + {"bits/stl_vector.h", ""}, + {"bits/stream_iterator.h", ""}, + {"bits/streambuf.tcc", ""}, + {"bits/streambuf_iterator.h", ""}, + {"bits/stringfwd.h", ""}, + {"bits/stropts.h", ""}, + {"bits/sys_errlist.h", ""}, + {"bits/syscall.h", ""}, + {"bits/syslog-path.h", ""}, + {"bits/termios.h", ""}, + {"bits/time.h", ""}, + {"bits/timerfd.h", ""}, + {"bits/timex.h", ""}, + {"bits/types.h", ""}, + {"bits/typesizes.h", ""}, + {"bits/uio.h", ""}, + {"bits/uniform_int_dist.h", ""}, + {"bits/unique_ptr.h", ""}, + {"bits/unordered_map.h", ""}, + {"bits/unordered_set.h", ""}, + {"bits/uses_allocator.h", ""}, + {"bits/ustat.h", ""}, + {"bits/utmp.h", ""}, + {"bits/utmpx.h", ""}, + {"bits/utsname.h", ""}, + {"bits/valarray_after.h", ""}, + {"bits/valarray_array.h", ""}, + {"bits/valarray_array.tcc", ""}, + {"bits/valarray_before.h", ""}, + {"bits/vector.tcc", ""}, + {"bits/waitflags.h", ""}, + {"bits/waitstatus.h", ""}, + {"bits/wchar.h", ""}, + {"bits/wordsize.h", ""}, + {"bits/xopen_lim.h", ""}, + {"bits/xtitypes.h", ""}, + {"bitset", ""}, + {"ccomplex", ""}, + {"cctype", ""}, + {"cerrno", ""}, + {"cfenv", ""}, + {"cfloat", ""}, + {"chrono", ""}, + {"cinttypes", ""}, + {"climits", ""}, + {"clocale", ""}, + {"cmath", ""}, + {"complex", ""}, + {"complex.h", ""}, + {"condition_variable", ""}, + {"csetjmp", ""}, + {"csignal", ""}, + {"cstdalign", ""}, + {"cstdarg", ""}, + {"cstdbool", ""}, + {"cstdint", ""}, + {"cstdio", ""}, + {"cstdlib", ""}, + {"cstring", ""}, + {"ctgmath", ""}, + {"ctime", ""}, + {"cwchar", ""}, + {"cwctype", ""}, + {"cxxabi.h", ""}, + {"debug/debug.h", ""}, + {"debug/map.h", ""}, + {"debug/multimap.h", ""}, + {"debug/multiset.h", ""}, + {"debug/set.h", ""}, + {"deque", ""}, + {"exception", ""}, + {"ext/alloc_traits.h", ""}, + {"ext/atomicity.h", ""}, + {"ext/concurrence.h", ""}, + {"ext/new_allocator.h", ""}, + {"ext/numeric_traits.h", ""}, + {"ext/string_conversions.h", ""}, + {"ext/type_traits.h", ""}, + {"fenv.h", ""}, + {"forward_list", ""}, + {"fpu_control.h", ""}, + {"fstream", ""}, + {"functional", ""}, + {"future", ""}, + {"gnu/lib-names.h", ""}, + {"gnu/libc-version.h", ""}, + {"gnu/option-groups.h", ""}, + {"gnu/stubs-32.h", ""}, + {"gnu/stubs-64.h", ""}, + {"gnu/stubs-x32.h", ""}, + {"ieee754.h", ""}, + {"include/_G_config.h", ""}, + {"include/__stddef_max_align_t.h", ""}, + {"include/__wmmintrin_aes.h", ""}, + {"include/__wmmintrin_pclmul.h", ""}, + {"include/adxintrin.h", ""}, + {"include/aio.h", ""}, + {"include/aliases.h", ""}, + {"include/alloca.h", ""}, + {"include/ammintrin.h", ""}, + {"include/ar.h", ""}, + {"include/argp.h", ""}, + {"include/argz.h", ""}, + {"include/arpa/nameser.h", ""}, + {"include/arpa/nameser_compat.h", ""}, + {"include/assert.h", ""}, + {"include/avx2intrin.h", ""}, + {"include/avx512bwintrin.h", ""}, + {"include/avx512cdintrin.h", ""}, + {"include/avx512dqintrin.h", ""}, + {"include/avx512erintrin.h", ""}, + {"include/avx512fintrin.h", ""}, + {"include/avx512ifmaintrin.h", ""}, + {"include/avx512ifmavlintrin.h", ""}, + {"include/avx512pfintrin.h", ""}, + {"include/avx512vbmiintrin.h", ""}, + {"include/avx512vbmivlintrin.h", ""}, + {"include/avx512vlbwintrin.h", ""}, + {"include/avx512vlcdintrin.h", ""}, + {"include/avx512vldqintrin.h", ""}, + {"include/avx512vlintrin.h", ""}, + {"include/avxintrin.h", ""}, + {"include/bmi2intrin.h", ""}, + {"include/bmiintrin.h", ""}, + {"include/byteswap.h", ""}, + {"include/complex.h", ""}, + {"include/cpio.h", ""}, + {"include/crypt.h", ""}, + {"include/ctype.h", ""}, + {"include/dirent.h", ""}, + {"include/dlfcn.h", ""}, + {"include/elf.h", ""}, + {"include/emmintrin.h", ""}, + {"include/endian.h", ""}, + {"include/envz.h", ""}, + {"include/err.h", ""}, + {"include/errno.h", ""}, + {"include/error.h", ""}, + {"include/execinfo.h", ""}, + {"include/f16cintrin.h", ""}, + {"include/fcntl.h", ""}, + {"include/features.h", ""}, + {"include/fenv.h", ""}, + {"include/float.h", ""}, + {"include/fma4intrin.h", ""}, + {"include/fmaintrin.h", ""}, + {"include/fmtmsg.h", ""}, + {"include/fnmatch.h", ""}, + {"include/fstab.h", ""}, + {"include/fts.h", ""}, + {"include/ftw.h", ""}, + {"include/fxsrintrin.h", ""}, + {"include/gconv.h", ""}, + {"include/getopt.h", ""}, + {"include/glob.h", ""}, + {"include/grp.h", ""}, + {"include/gshadow.h", ""}, + {"include/ia32intrin.h", ""}, + {"include/iconv.h", ""}, + {"include/ifaddrs.h", ""}, + {"include/immintrin.h", ""}, + {"include/inttypes.h", ""}, + {"include/kdb.h", ""}, + {"include/langinfo.h", ""}, + {"include/libgen.h", ""}, + {"include/libintl.h", ""}, + {"include/libio.h", ""}, + {"include/limits.h", ""}, + {"include/link.h", ""}, + {"include/locale.h", ""}, + {"include/lzcntintrin.h", ""}, + {"include/malloc.h", ""}, + {"include/math.h", ""}, + {"include/mcheck.h", ""}, + {"include/memory.h", ""}, + {"include/mm3dnow.h", ""}, + {"include/mm_malloc.h", ""}, + {"include/mmintrin.h", ""}, + {"include/mntent.h", ""}, + {"include/monetary.h", ""}, + {"include/mqueue.h", ""}, + {"include/mwaitxintrin.h", ""}, + {"include/netatalk/at.h", ""}, + {"include/netdb.h", ""}, + {"include/netinet/ether.h", ""}, + {"include/netinet/icmp6.h", ""}, + {"include/netinet/if_ether.h", ""}, + {"include/netinet/if_fddi.h", ""}, + {"include/netinet/if_tr.h", ""}, + {"include/netinet/igmp.h", ""}, + {"include/netinet/in.h", ""}, + {"include/netinet/in_systm.h", ""}, + {"include/netinet/ip.h", ""}, + {"include/netinet/ip6.h", ""}, + {"include/netinet/ip_icmp.h", ""}, + {"include/netinet/tcp.h", ""}, + {"include/netinet/udp.h", ""}, + {"include/netrom/netrom.h", ""}, + {"include/netrose/rose.h", ""}, + {"include/nfs/nfs.h", ""}, + {"include/nl_types.h", ""}, + {"include/nss.h", ""}, + {"include/obstack.h", ""}, + {"include/panel.h", ""}, + {"include/paths.h", ""}, + {"include/pkuintrin.h", ""}, + {"include/pmmintrin.h", ""}, + {"include/popcntintrin.h", ""}, + {"include/prfchwintrin.h", ""}, + {"include/printf.h", ""}, + {"include/profile.h", ""}, + {"include/protocols/routed.h", ""}, + {"include/protocols/rwhod.h", ""}, + {"include/protocols/talkd.h", ""}, + {"include/protocols/timed.h", ""}, + {"include/pthread.h", ""}, + {"include/pty.h", ""}, + {"include/pwd.h", ""}, + {"include/rdseedintrin.h", ""}, + {"include/re_comp.h", ""}, + {"include/regex.h", ""}, + {"include/regexp.h", ""}, + {"include/resolv.h", ""}, + {"include/rpc/auth.h", ""}, + {"include/rpc/auth_des.h", ""}, + {"include/rpc/auth_unix.h", ""}, + {"include/rpc/clnt.h", ""}, + {"include/rpc/des_crypt.h", ""}, + {"include/rpc/key_prot.h", ""}, + {"include/rpc/netdb.h", ""}, + {"include/rpc/pmap_clnt.h", ""}, + {"include/rpc/pmap_prot.h", ""}, + {"include/rpc/pmap_rmt.h", ""}, + {"include/rpc/rpc.h", ""}, + {"include/rpc/rpc_des.h", ""}, + {"include/rpc/rpc_msg.h", ""}, + {"include/rpc/svc.h", ""}, + {"include/rpc/svc_auth.h", ""}, + {"include/rpc/types.h", ""}, + {"include/rpc/xdr.h", ""}, + {"include/rpcsvc/bootparam.h", ""}, + {"include/rpcsvc/bootparam_prot.h", ""}, + {"include/rpcsvc/bootparam_prot.x", ""}, + {"include/rpcsvc/key_prot.h", ""}, + {"include/rpcsvc/key_prot.x", ""}, + {"include/rpcsvc/klm_prot.h", ""}, + {"include/rpcsvc/klm_prot.x", ""}, + {"include/rpcsvc/mount.h", ""}, + {"include/rpcsvc/mount.x", ""}, + {"include/rpcsvc/nfs_prot.h", ""}, + {"include/rpcsvc/nfs_prot.x", ""}, + {"include/rpcsvc/nis.h", ""}, + {"include/rpcsvc/nis.x", ""}, + {"include/rpcsvc/nis_callback.h", ""}, + {"include/rpcsvc/nis_callback.x", ""}, + {"include/rpcsvc/nis_object.x", ""}, + {"include/rpcsvc/nis_tags.h", ""}, + {"include/rpcsvc/nislib.h", ""}, + {"include/rpcsvc/nlm_prot.h", ""}, + {"include/rpcsvc/nlm_prot.x", ""}, + {"include/rpcsvc/rex.h", ""}, + {"include/rpcsvc/rex.x", ""}, + {"include/rpcsvc/rquota.h", ""}, + {"include/rpcsvc/rquota.x", ""}, + {"include/rpcsvc/rstat.h", ""}, + {"include/rpcsvc/rstat.x", ""}, + {"include/rpcsvc/rusers.h", ""}, + {"include/rpcsvc/rusers.x", ""}, + {"include/rpcsvc/sm_inter.h", ""}, + {"include/rpcsvc/sm_inter.x", ""}, + {"include/rpcsvc/spray.h", ""}, + {"include/rpcsvc/spray.x", ""}, + {"include/rpcsvc/yp.h", ""}, + {"include/rpcsvc/yp.x", ""}, + {"include/rpcsvc/yp_prot.h", ""}, + {"include/rpcsvc/ypclnt.h", ""}, + {"include/rpcsvc/yppasswd.h", ""}, + {"include/rpcsvc/yppasswd.x", ""}, + {"include/rpcsvc/ypupd.h", ""}, + {"include/rtmintrin.h", ""}, + {"include/sched.h", ""}, + {"include/scsi/scsi.h", ""}, + {"include/scsi/scsi_ioctl.h", ""}, + {"include/scsi/sg.h", ""}, + {"include/search.h", ""}, + {"include/semaphore.h", ""}, + {"include/setjmp.h", ""}, + {"include/sgtty.h", ""}, + {"include/shadow.h", ""}, + {"include/shaintrin.h", ""}, + {"include/signal.h", ""}, + {"include/smmintrin.h", ""}, + {"include/spawn.h", ""}, + {"include/stab.h", ""}, + {"include/stdalign.h", ""}, + {"include/stdarg.h", ""}, + {"include/stdbool.h", ""}, + {"include/stdc-predef.h", ""}, + {"include/stddef.h", ""}, + {"include/stdint.h", ""}, + {"include/stdio.h", ""}, + {"include/stdio_ext.h", ""}, + {"include/stdlib.h", ""}, + {"include/string.h", ""}, + {"include/strings.h", ""}, + {"include/stropts.h", ""}, + {"include/sudo_plugin.h", ""}, + {"include/sysexits.h", ""}, + {"include/tar.h", ""}, + {"include/tbmintrin.h", ""}, + {"include/tcpd.h", ""}, + {"include/term.h", ""}, + {"include/term_entry.h", ""}, + {"include/termcap.h", ""}, + {"include/termios.h", ""}, + {"include/thread_db.h", ""}, + {"include/tic.h", ""}, + {"include/time.h", ""}, + {"include/tmmintrin.h", ""}, + {"include/ttyent.h", ""}, + {"include/uchar.h", ""}, + {"include/ucontext.h", ""}, + {"include/ulimit.h", ""}, + {"include/unctrl.h", ""}, + {"include/unistd.h", ""}, + {"include/utime.h", ""}, + {"include/utmp.h", ""}, + {"include/utmpx.h", ""}, + {"include/values.h", ""}, + {"include/wchar.h", ""}, + {"include/wctype.h", ""}, + {"include/wmmintrin.h", ""}, + {"include/wordexp.h", ""}, + {"include/x86intrin.h", ""}, + {"include/xlocale.h", ""}, + {"include/xmmintrin.h", ""}, + {"include/xopintrin.h", ""}, + {"include/xsavecintrin.h", ""}, + {"include/xsaveintrin.h", ""}, + {"include/xsaveoptintrin.h", ""}, + {"include/xsavesintrin.h", ""}, + {"include/xtestintrin.h", ""}, + {"initializer_list", ""}, + {"iomanip", ""}, + {"ios", ""}, + {"iosfwd", ""}, + {"iostream", ""}, + {"istream", ""}, + {"iterator", ""}, + {"limits", ""}, + {"list", ""}, + {"locale", ""}, + {"map", ""}, + {"memory", ""}, + {"mutex", ""}, + {"new", ""}, + {"numeric", ""}, + {"ostream", ""}, + {"queue", ""}, + {"random", ""}, + {"ratio", ""}, + {"regex", ""}, + {"scoped_allocator", ""}, + {"set", ""}, + {"shared_mutex", ""}, + {"sstream", ""}, + {"stack", ""}, + {"stdexcept", ""}, + {"streambuf", ""}, + {"string", ""}, + {"sys/acct.h", ""}, + {"sys/auxv.h", ""}, + {"sys/cdefs.h", ""}, + {"sys/debugreg.h", ""}, + {"sys/dir.h", ""}, + {"sys/elf.h", ""}, + {"sys/epoll.h", ""}, + {"sys/eventfd.h", ""}, + {"sys/fanotify.h", ""}, + {"sys/file.h", ""}, + {"sys/fsuid.h", ""}, + {"sys/gmon.h", ""}, + {"sys/gmon_out.h", ""}, + {"sys/inotify.h", ""}, + {"sys/io.h", ""}, + {"sys/ioctl.h", ""}, + {"sys/ipc.h", ""}, + {"sys/kd.h", ""}, + {"sys/kdaemon.h", ""}, + {"sys/klog.h", ""}, + {"sys/mman.h", ""}, + {"sys/mount.h", ""}, + {"sys/msg.h", ""}, + {"sys/mtio.h", ""}, + {"sys/param.h", ""}, + {"sys/pci.h", ""}, + {"sys/perm.h", ""}, + {"sys/personality.h", ""}, + {"sys/poll.h", ""}, + {"sys/prctl.h", ""}, + {"sys/procfs.h", ""}, + {"sys/profil.h", ""}, + {"sys/ptrace.h", ""}, + {"sys/queue.h", ""}, + {"sys/quota.h", ""}, + {"sys/raw.h", ""}, + {"sys/reboot.h", ""}, + {"sys/reg.h", ""}, + {"sys/resource.h", ""}, + {"sys/select.h", ""}, + {"sys/sem.h", ""}, + {"sys/sendfile.h", ""}, + {"sys/shm.h", ""}, + {"sys/signalfd.h", ""}, + {"sys/socket.h", ""}, + {"sys/stat.h", ""}, + {"sys/statfs.h", ""}, + {"sys/statvfs.h", ""}, + {"sys/swap.h", ""}, + {"sys/syscall.h", ""}, + {"sys/sysctl.h", ""}, + {"sys/sysinfo.h", ""}, + {"sys/syslog.h", ""}, + {"sys/sysmacros.h", ""}, + {"sys/termios.h", ""}, + {"sys/time.h", ""}, + {"sys/timeb.h", ""}, + {"sys/timerfd.h", ""}, + {"sys/times.h", ""}, + {"sys/timex.h", ""}, + {"sys/ttychars.h", ""}, + {"sys/ttydefaults.h", ""}, + {"sys/types.h", ""}, + {"sys/ucontext.h", ""}, + {"sys/uio.h", ""}, + {"sys/un.h", ""}, + {"sys/user.h", ""}, + {"sys/ustat.h", ""}, + {"sys/utsname.h", ""}, + {"sys/vlimit.h", ""}, + {"sys/vm86.h", ""}, + {"sys/vtimes.h", ""}, + {"sys/wait.h", ""}, + {"sys/xattr.h", ""}, + {"system_error", ""}, + {"tgmath.h", ""}, + {"thread", ""}, + {"tuple", ""}, + {"type_traits", ""}, + {"typeindex", ""}, + {"typeinfo", ""}, + {"unordered_map", ""}, + {"unordered_set", ""}, + {"utility", ""}, + {"valarray", ""}, + {"vector", ""}, + }}; + auto *HeaderMapping = new llvm::StringMap(Mappings->size()); + + auto Canonicalize = [](std::string &S) { + SmallString<32> Tmp(S); + llvm::sys::path::make_preferred(Tmp); + S.assign(Tmp.data(), Tmp.size()); + }; + for (auto &p : *Mappings) { + Canonicalize(p.first); + Canonicalize(p.second); + + auto Result = HeaderMapping->insert(p); + assert(Result.second); // No duplicates. + } + return HeaderMapping; +} + } // namespace void CanonicalIncludes::addMapping(FileEntryRef Header, @@ -109,677 +775,23 @@ // FIXME: remove the std header mapping once we support ambiguous symbols, now // it serves as a fallback to disambiguate: // - symbols with multiple headers (e.g. std::move) - static const auto *SystemHeaderMap = new llvm::StringMap({ - {"include/__stddef_max_align_t.h", ""}, - {"include/__wmmintrin_aes.h", ""}, - {"include/__wmmintrin_pclmul.h", ""}, - {"include/adxintrin.h", ""}, - {"include/ammintrin.h", ""}, - {"include/avx2intrin.h", ""}, - {"include/avx512bwintrin.h", ""}, - {"include/avx512cdintrin.h", ""}, - {"include/avx512dqintrin.h", ""}, - {"include/avx512erintrin.h", ""}, - {"include/avx512fintrin.h", ""}, - {"include/avx512ifmaintrin.h", ""}, - {"include/avx512ifmavlintrin.h", ""}, - {"include/avx512pfintrin.h", ""}, - {"include/avx512vbmiintrin.h", ""}, - {"include/avx512vbmivlintrin.h", ""}, - {"include/avx512vlbwintrin.h", ""}, - {"include/avx512vlcdintrin.h", ""}, - {"include/avx512vldqintrin.h", ""}, - {"include/avx512vlintrin.h", ""}, - {"include/avxintrin.h", ""}, - {"include/bmi2intrin.h", ""}, - {"include/bmiintrin.h", ""}, - {"include/emmintrin.h", ""}, - {"include/f16cintrin.h", ""}, - {"include/float.h", ""}, - {"include/fma4intrin.h", ""}, - {"include/fmaintrin.h", ""}, - {"include/fxsrintrin.h", ""}, - {"include/ia32intrin.h", ""}, - {"include/immintrin.h", ""}, - {"include/inttypes.h", ""}, - {"include/limits.h", ""}, - {"include/lzcntintrin.h", ""}, - {"include/mm3dnow.h", ""}, - {"include/mm_malloc.h", ""}, - {"include/mmintrin.h", ""}, - {"include/mwaitxintrin.h", ""}, - {"include/pkuintrin.h", ""}, - {"include/pmmintrin.h", ""}, - {"include/popcntintrin.h", ""}, - {"include/prfchwintrin.h", ""}, - {"include/rdseedintrin.h", ""}, - {"include/rtmintrin.h", ""}, - {"include/shaintrin.h", ""}, - {"include/smmintrin.h", ""}, - {"include/stdalign.h", ""}, - {"include/stdarg.h", ""}, - {"include/stdbool.h", ""}, - {"include/stddef.h", ""}, - {"include/stdint.h", ""}, - {"include/tbmintrin.h", ""}, - {"include/tmmintrin.h", ""}, - {"include/wmmintrin.h", ""}, - {"include/x86intrin.h", ""}, - {"include/xmmintrin.h", ""}, - {"include/xopintrin.h", ""}, - {"include/xsavecintrin.h", ""}, - {"include/xsaveintrin.h", ""}, - {"include/xsaveoptintrin.h", ""}, - {"include/xsavesintrin.h", ""}, - {"include/xtestintrin.h", ""}, - {"include/_G_config.h", ""}, - {"include/assert.h", ""}, - {"algorithm", ""}, - {"valarray", ""}, - {"array", ""}, - {"atomic", ""}, - {"backward/auto_ptr.h", ""}, - {"backward/binders.h", ""}, - {"bits/algorithmfwd.h", ""}, - {"bits/alloc_traits.h", ""}, - {"bits/allocated_ptr.h", ""}, - {"bits/allocator.h", ""}, - {"bits/atomic_base.h", ""}, - {"bits/atomic_lockfree_defines.h", ""}, - {"bits/atomic_futex.h", ""}, - {"bits/basic_ios.h", ""}, - {"bits/basic_ios.tcc", ""}, - {"bits/basic_string.h", ""}, - {"bits/basic_string.tcc", ""}, - {"bits/char_traits.h", ""}, - {"bits/codecvt.h", ""}, - {"bits/concept_check.h", ""}, - {"bits/cpp_type_traits.h", ""}, - {"bits/cxxabi_forced.h", ""}, - {"bits/deque.tcc", ""}, - {"bits/exception.h", ""}, - {"bits/exception_defines.h", ""}, - {"bits/exception_ptr.h", ""}, - {"bits/forward_list.h", ""}, - {"bits/forward_list.tcc", ""}, - {"bits/fstream.tcc", ""}, - {"bits/functexcept.h", ""}, - {"bits/functional_hash.h", ""}, - {"bits/gslice.h", ""}, - {"bits/gslice_array.h", ""}, - {"bits/hash_bytes.h", ""}, - {"bits/hashtable.h", ""}, - {"bits/hashtable_policy.h", ""}, - {"bits/indirect_array.h", ""}, - {"bits/invoke.h", ""}, - {"bits/ios_base.h", ""}, - {"bits/istream.tcc", ""}, - {"bits/list.tcc", ""}, - {"bits/locale_classes.h", ""}, - {"bits/locale_classes.tcc", ""}, - {"bits/locale_conv.h", ""}, - {"bits/locale_facets.h", ""}, - {"bits/locale_facets.tcc", ""}, - {"bits/locale_facets_nonio.h", ""}, - {"bits/locale_facets_nonio.tcc", ""}, - {"bits/localefwd.h", ""}, - {"bits/mask_array.h", ""}, - {"bits/memoryfwd.h", ""}, - {"bits/move.h", ""}, - {"bits/nested_exception.h", ""}, - {"bits/ostream.tcc", ""}, - {"bits/ostream_insert.h", ""}, - {"bits/parse_numbers.h", ""}, - {"bits/postypes.h", ""}, - {"bits/predefined_ops.h", ""}, - {"bits/ptr_traits.h", ""}, - {"bits/quoted_string.h", ""}, - {"bits/random.h", ""}, - {"bits/random.tcc", ""}, - {"bits/range_access.h", ""}, - {"bits/refwrap.h", ""}, - {"bits/regex.h", ""}, - {"bits/regex_automaton.h", ""}, - {"bits/regex_compiler.h", ""}, - {"bits/regex_constants.h", ""}, - {"bits/regex_cursor.h", ""}, - {"bits/regex_error.h", ""}, - {"bits/regex_executor.h", ""}, - {"bits/regex_grep_matcher.h", ""}, - {"bits/regex_grep_matcher.tcc", ""}, - {"bits/regex_nfa.h", ""}, - {"bits/regex_scanner.h", ""}, - {"bits/shared_ptr.h", ""}, - {"bits/shared_ptr_base.h", ""}, - {"bits/shared_ptr_atomic.h", ""}, - {"bits/slice_array.h", ""}, - {"bits/sstream.tcc", ""}, - {"bits/std_abs.h", ""}, - {"bits/std_function.h", ""}, - {"bits/std_mutex.h", ""}, - {"bits/stl_algo.h", ""}, - {"bits/stl_algobase.h", ""}, - {"bits/stl_bvector.h", ""}, - {"bits/stl_construct.h", ""}, - {"bits/stl_deque.h", ""}, - {"bits/stl_function.h", ""}, - {"bits/stl_heap.h", ""}, - {"bits/stl_iterator.h", ""}, - {"bits/stl_iterator_base_funcs.h", ""}, - {"bits/stl_iterator_base_types.h", ""}, - {"bits/stl_list.h", ""}, - {"bits/stl_map.h", ""}, - {"bits/stl_multimap.h", ""}, - {"bits/stl_multiset.h", ""}, - {"bits/stl_numeric.h", ""}, - {"bits/stl_pair.h", ""}, - {"bits/stl_queue.h", ""}, - {"bits/stl_raw_storage_iter.h", ""}, - {"bits/stl_relops.h", ""}, - {"bits/stl_set.h", ""}, - {"bits/stl_stack.h", ""}, - {"bits/stl_tempbuf.h", ""}, - {"bits/stl_tree.h", ""}, - {"bits/stl_uninitialized.h", ""}, - {"bits/stl_vector.h", ""}, - {"bits/stream_iterator.h", ""}, - {"bits/streambuf.tcc", ""}, - {"bits/streambuf_iterator.h", ""}, - {"bits/stringfwd.h", ""}, - {"bits/uniform_int_dist.h", ""}, - {"bits/unique_ptr.h", ""}, - {"bits/unordered_map.h", ""}, - {"bits/unordered_set.h", ""}, - {"bits/uses_allocator.h", ""}, - {"bits/valarray_after.h", ""}, - {"bits/valarray_array.h", ""}, - {"bits/valarray_array.tcc", ""}, - {"bits/valarray_before.h", ""}, - {"bits/vector.tcc", ""}, - {"bitset", ""}, - {"ccomplex", ""}, - {"cctype", ""}, - {"cerrno", ""}, - {"cfenv", ""}, - {"cfloat", ""}, - {"chrono", ""}, - {"cinttypes", ""}, - {"climits", ""}, - {"clocale", ""}, - {"cmath", ""}, - {"complex", ""}, - {"complex.h", ""}, - {"condition_variable", ""}, - {"csetjmp", ""}, - {"csignal", ""}, - {"cstdalign", ""}, - {"cstdarg", ""}, - {"cstdbool", ""}, - {"cstdint", ""}, - {"cstdio", ""}, - {"cstdlib", ""}, - {"cstring", ""}, - {"ctgmath", ""}, - {"ctime", ""}, - {"cwchar", ""}, - {"cwctype", ""}, - {"cxxabi.h", ""}, - {"debug/debug.h", ""}, - {"debug/map.h", ""}, - {"debug/multimap.h", ""}, - {"debug/multiset.h", ""}, - {"debug/set.h", ""}, - {"deque", ""}, - {"exception", ""}, - {"ext/alloc_traits.h", ""}, - {"ext/atomicity.h", ""}, - {"ext/concurrence.h", ""}, - {"ext/new_allocator.h", ""}, - {"ext/numeric_traits.h", ""}, - {"ext/string_conversions.h", ""}, - {"ext/type_traits.h", ""}, - {"fenv.h", ""}, - {"forward_list", ""}, - {"fstream", ""}, - {"functional", ""}, - {"future", ""}, - {"initializer_list", ""}, - {"iomanip", ""}, - {"ios", ""}, - {"iosfwd", ""}, - {"iostream", ""}, - {"istream", ""}, - {"iterator", ""}, - {"limits", ""}, - {"list", ""}, - {"locale", ""}, - {"map", ""}, - {"memory", ""}, - {"shared_mutex", ""}, - {"mutex", ""}, - {"new", ""}, - {"numeric", ""}, - {"ostream", ""}, - {"queue", ""}, - {"random", ""}, - {"ratio", ""}, - {"regex", ""}, - {"scoped_allocator", ""}, - {"set", ""}, - {"sstream", ""}, - {"stack", ""}, - {"stdexcept", ""}, - {"streambuf", ""}, - {"string", ""}, - {"system_error", ""}, - {"tgmath.h", ""}, - {"thread", ""}, - {"tuple", ""}, - {"type_traits", ""}, - {"typeindex", ""}, - {"typeinfo", ""}, - {"unordered_map", ""}, - {"unordered_set", ""}, - {"utility", ""}, - {"valarray", ""}, - {"vector", ""}, - {"include/complex.h", ""}, - {"include/ctype.h", ""}, - {"include/errno.h", ""}, - {"include/fenv.h", ""}, - {"include/inttypes.h", ""}, - {"include/libio.h", ""}, - {"include/limits.h", ""}, - {"include/locale.h", ""}, - {"include/math.h", ""}, - {"include/setjmp.h", ""}, - {"include/signal.h", ""}, - {"include/stdint.h", ""}, - {"include/stdio.h", ""}, - {"include/stdlib.h", ""}, - {"include/string.h", ""}, - {"include/time.h", ""}, - {"include/wchar.h", ""}, - {"include/wctype.h", ""}, - {"bits/cmathcalls.h", ""}, - {"bits/errno.h", ""}, - {"bits/fenv.h", ""}, - {"bits/huge_val.h", ""}, - {"bits/huge_valf.h", ""}, - {"bits/huge_vall.h", ""}, - {"bits/inf.h", ""}, - {"bits/local_lim.h", ""}, - {"bits/locale.h", ""}, - {"bits/mathcalls.h", ""}, - {"bits/mathdef.h", ""}, - {"bits/nan.h", ""}, - {"bits/posix1_lim.h", ""}, - {"bits/posix2_lim.h", ""}, - {"bits/setjmp.h", ""}, - {"bits/sigaction.h", ""}, - {"bits/sigcontext.h", ""}, - {"bits/siginfo.h", ""}, - {"bits/signum.h", ""}, - {"bits/sigset.h", ""}, - {"bits/sigstack.h", ""}, - {"bits/stdint-intn.h", ""}, - {"bits/stdint-uintn.h", ""}, - {"bits/stdio_lim.h", ""}, - {"bits/sys_errlist.h", ""}, - {"bits/time.h", ""}, - {"bits/timex.h", ""}, - {"bits/typesizes.h", ""}, - {"bits/wchar.h", ""}, - {"bits/wordsize.h", ""}, - {"bits/xopen_lim.h", ""}, - {"include/xlocale.h", ""}, - {"bits/atomic_word.h", ""}, - {"bits/basic_file.h", ""}, - {"bits/c\\+\\+allocator.h", ""}, - {"bits/c\\+\\+config.h", ""}, - {"bits/c\\+\\+io.h", ""}, - {"bits/c\\+\\+locale.h", ""}, - {"bits/cpu_defines.h", ""}, - {"bits/ctype_base.h", ""}, - {"bits/cxxabi_tweaks.h", ""}, - {"bits/error_constants.h", ""}, - {"bits/gthr-default.h", ""}, - {"bits/gthr.h", ""}, - {"bits/opt_random.h", ""}, - {"bits/os_defines.h", ""}, - // GNU C headers - {"include/aio.h", ""}, - {"include/aliases.h", ""}, - {"include/alloca.h", ""}, - {"include/ar.h", ""}, - {"include/argp.h", ""}, - {"include/argz.h", ""}, - {"include/arpa/nameser.h", ""}, - {"include/arpa/nameser_compat.h", ""}, - {"include/byteswap.h", ""}, - {"include/cpio.h", ""}, - {"include/crypt.h", ""}, - {"include/dirent.h", ""}, - {"include/dlfcn.h", ""}, - {"include/elf.h", ""}, - {"include/endian.h", ""}, - {"include/envz.h", ""}, - {"include/err.h", ""}, - {"include/error.h", ""}, - {"include/execinfo.h", ""}, - {"include/fcntl.h", ""}, - {"include/features.h", ""}, - {"include/fenv.h", ""}, - {"include/fmtmsg.h", ""}, - {"include/fnmatch.h", ""}, - {"include/fstab.h", ""}, - {"include/fts.h", ""}, - {"include/ftw.h", ""}, - {"include/gconv.h", ""}, - {"include/getopt.h", ""}, - {"include/glob.h", ""}, - {"include/grp.h", ""}, - {"include/gshadow.h", ""}, - {"include/iconv.h", ""}, - {"include/ifaddrs.h", ""}, - {"include/kdb.h", ""}, - {"include/langinfo.h", ""}, - {"include/libgen.h", ""}, - {"include/libintl.h", ""}, - {"include/link.h", ""}, - {"include/malloc.h", ""}, - {"include/mcheck.h", ""}, - {"include/memory.h", ""}, - {"include/mntent.h", ""}, - {"include/monetary.h", ""}, - {"include/mqueue.h", ""}, - {"include/netdb.h", ""}, - {"include/netinet/in.h", ""}, - {"include/nl_types.h", ""}, - {"include/nss.h", ""}, - {"include/obstack.h", ""}, - {"include/panel.h", ""}, - {"include/paths.h", ""}, - {"include/printf.h", ""}, - {"include/profile.h", ""}, - {"include/pthread.h", ""}, - {"include/pty.h", ""}, - {"include/pwd.h", ""}, - {"include/re_comp.h", ""}, - {"include/regex.h", ""}, - {"include/regexp.h", ""}, - {"include/resolv.h", ""}, - {"include/rpc/netdb.h", ""}, - {"include/sched.h", ""}, - {"include/search.h", ""}, - {"include/semaphore.h", ""}, - {"include/sgtty.h", ""}, - {"include/shadow.h", ""}, - {"include/spawn.h", ""}, - {"include/stab.h", ""}, - {"include/stdc-predef.h", ""}, - {"include/stdio_ext.h", ""}, - {"include/strings.h", ""}, - {"include/stropts.h", ""}, - {"include/sudo_plugin.h", ""}, - {"include/sysexits.h", ""}, - {"include/tar.h", ""}, - {"include/tcpd.h", ""}, - {"include/term.h", ""}, - {"include/term_entry.h", ""}, - {"include/termcap.h", ""}, - {"include/termios.h", ""}, - {"include/thread_db.h", ""}, - {"include/tic.h", ""}, - {"include/ttyent.h", ""}, - {"include/uchar.h", ""}, - {"include/ucontext.h", ""}, - {"include/ulimit.h", ""}, - {"include/unctrl.h", ""}, - {"include/unistd.h", ""}, - {"include/utime.h", ""}, - {"include/utmp.h", ""}, - {"include/utmpx.h", ""}, - {"include/values.h", ""}, - {"include/wordexp.h", ""}, - {"fpu_control.h", ""}, - {"ieee754.h", ""}, - {"include/xlocale.h", ""}, - {"gnu/lib-names.h", ""}, - {"gnu/libc-version.h", ""}, - {"gnu/option-groups.h", ""}, - {"gnu/stubs-32.h", ""}, - {"gnu/stubs-64.h", ""}, - {"gnu/stubs-x32.h", ""}, - {"include/rpc/auth_des.h", ""}, - {"include/rpc/rpc_msg.h", ""}, - {"include/rpc/pmap_clnt.h", ""}, - {"include/rpc/rpc.h", ""}, - {"include/rpc/types.h", ""}, - {"include/rpc/auth_unix.h", ""}, - {"include/rpc/key_prot.h", ""}, - {"include/rpc/pmap_prot.h", ""}, - {"include/rpc/auth.h", ""}, - {"include/rpc/svc_auth.h", ""}, - {"include/rpc/xdr.h", ""}, - {"include/rpc/pmap_rmt.h", ""}, - {"include/rpc/des_crypt.h", ""}, - {"include/rpc/svc.h", ""}, - {"include/rpc/rpc_des.h", ""}, - {"include/rpc/clnt.h", ""}, - {"include/scsi/scsi.h", ""}, - {"include/scsi/sg.h", ""}, - {"include/scsi/scsi_ioctl.h", ""}, - {"include/netrose/rose.h", ""}, - {"include/nfs/nfs.h", ""}, - {"include/netatalk/at.h", ""}, - {"include/netinet/ether.h", ""}, - {"include/netinet/icmp6.h", ""}, - {"include/netinet/if_ether.h", ""}, - {"include/netinet/if_fddi.h", ""}, - {"include/netinet/if_tr.h", ""}, - {"include/netinet/igmp.h", ""}, - {"include/netinet/in.h", ""}, - {"include/netinet/in_systm.h", ""}, - {"include/netinet/ip.h", ""}, - {"include/netinet/ip6.h", ""}, - {"include/netinet/ip_icmp.h", ""}, - {"include/netinet/tcp.h", ""}, - {"include/netinet/udp.h", ""}, - {"include/netrom/netrom.h", ""}, - {"include/protocols/routed.h", ""}, - {"include/protocols/rwhod.h", ""}, - {"include/protocols/talkd.h", ""}, - {"include/protocols/timed.h", ""}, - {"include/rpcsvc/klm_prot.x", ""}, - {"include/rpcsvc/rstat.h", ""}, - {"include/rpcsvc/spray.x", ""}, - {"include/rpcsvc/nlm_prot.x", ""}, - {"include/rpcsvc/nis_callback.x", ""}, - {"include/rpcsvc/yp.h", ""}, - {"include/rpcsvc/yp.x", ""}, - {"include/rpcsvc/nfs_prot.h", ""}, - {"include/rpcsvc/rex.h", ""}, - {"include/rpcsvc/yppasswd.h", ""}, - {"include/rpcsvc/rex.x", ""}, - {"include/rpcsvc/nis_tags.h", ""}, - {"include/rpcsvc/nis_callback.h", ""}, - {"include/rpcsvc/nfs_prot.x", ""}, - {"include/rpcsvc/bootparam_prot.x", ""}, - {"include/rpcsvc/rusers.x", ""}, - {"include/rpcsvc/rquota.x", ""}, - {"include/rpcsvc/nis.h", ""}, - {"include/rpcsvc/nislib.h", ""}, - {"include/rpcsvc/ypupd.h", ""}, - {"include/rpcsvc/bootparam.h", ""}, - {"include/rpcsvc/spray.h", ""}, - {"include/rpcsvc/key_prot.h", ""}, - {"include/rpcsvc/klm_prot.h", ""}, - {"include/rpcsvc/sm_inter.h", ""}, - {"include/rpcsvc/nlm_prot.h", ""}, - {"include/rpcsvc/yp_prot.h", ""}, - {"include/rpcsvc/ypclnt.h", ""}, - {"include/rpcsvc/rstat.x", ""}, - {"include/rpcsvc/rusers.h", ""}, - {"include/rpcsvc/key_prot.x", ""}, - {"include/rpcsvc/sm_inter.x", ""}, - {"include/rpcsvc/rquota.h", ""}, - {"include/rpcsvc/nis.x", ""}, - {"include/rpcsvc/bootparam_prot.h", ""}, - {"include/rpcsvc/mount.h", ""}, - {"include/rpcsvc/mount.x", ""}, - {"include/rpcsvc/nis_object.x", ""}, - {"include/rpcsvc/yppasswd.x", ""}, - {"sys/acct.h", ""}, - {"sys/auxv.h", ""}, - {"sys/cdefs.h", ""}, - {"sys/debugreg.h", ""}, - {"sys/dir.h", ""}, - {"sys/elf.h", ""}, - {"sys/epoll.h", ""}, - {"sys/eventfd.h", ""}, - {"sys/fanotify.h", ""}, - {"sys/file.h", ""}, - {"sys/fsuid.h", ""}, - {"sys/gmon.h", ""}, - {"sys/gmon_out.h", ""}, - {"sys/inotify.h", ""}, - {"sys/io.h", ""}, - {"sys/ioctl.h", ""}, - {"sys/ipc.h", ""}, - {"sys/kd.h", ""}, - {"sys/kdaemon.h", ""}, - {"sys/klog.h", ""}, - {"sys/mman.h", ""}, - {"sys/mount.h", ""}, - {"sys/msg.h", ""}, - {"sys/mtio.h", ""}, - {"sys/param.h", ""}, - {"sys/pci.h", ""}, - {"sys/perm.h", ""}, - {"sys/personality.h", ""}, - {"sys/poll.h", ""}, - {"sys/prctl.h", ""}, - {"sys/procfs.h", ""}, - {"sys/profil.h", ""}, - {"sys/ptrace.h", ""}, - {"sys/queue.h", ""}, - {"sys/quota.h", ""}, - {"sys/raw.h", ""}, - {"sys/reboot.h", ""}, - {"sys/reg.h", ""}, - {"sys/resource.h", ""}, - {"sys/select.h", ""}, - {"sys/sem.h", ""}, - {"sys/sendfile.h", ""}, - {"sys/shm.h", ""}, - {"sys/signalfd.h", ""}, - {"sys/socket.h", ""}, - {"sys/stat.h", ""}, - {"sys/statfs.h", ""}, - {"sys/statvfs.h", ""}, - {"sys/swap.h", ""}, - {"sys/syscall.h", ""}, - {"sys/sysctl.h", ""}, - {"sys/sysinfo.h", ""}, - {"sys/syslog.h", ""}, - {"sys/sysmacros.h", ""}, - {"sys/termios.h", ""}, - {"sys/time.h", ""}, - {"sys/timeb.h", ""}, - {"sys/timerfd.h", ""}, - {"sys/times.h", ""}, - {"sys/timex.h", ""}, - {"sys/ttychars.h", ""}, - {"sys/ttydefaults.h", ""}, - {"sys/types.h", ""}, - {"sys/ucontext.h", ""}, - {"sys/uio.h", ""}, - {"sys/un.h", ""}, - {"sys/user.h", ""}, - {"sys/ustat.h", ""}, - {"sys/utsname.h", ""}, - {"sys/vlimit.h", ""}, - {"sys/vm86.h", ""}, - {"sys/vtimes.h", ""}, - {"sys/wait.h", ""}, - {"sys/xattr.h", ""}, - {"bits/epoll.h", ""}, - {"bits/eventfd.h", ""}, - {"bits/inotify.h", ""}, - {"bits/ipc.h", ""}, - {"bits/ipctypes.h", ""}, - {"bits/mman-linux.h", ""}, - {"bits/mman.h", ""}, - {"bits/msq.h", ""}, - {"bits/resource.h", ""}, - {"bits/sem.h", ""}, - {"bits/shm.h", ""}, - {"bits/signalfd.h", ""}, - {"bits/statfs.h", ""}, - {"bits/statvfs.h", ""}, - {"bits/timerfd.h", ""}, - {"bits/utsname.h", ""}, - {"bits/auxv.h", ""}, - {"bits/byteswap-16.h", ""}, - {"bits/byteswap.h", ""}, - {"bits/confname.h", ""}, - {"bits/dirent.h", ""}, - {"bits/dlfcn.h", ""}, - {"bits/elfclass.h", ""}, - {"bits/endian.h", ""}, - {"bits/environments.h", ""}, - {"bits/fcntl-linux.h", ""}, - {"bits/fcntl.h", ""}, - {"bits/in.h", ""}, - {"bits/ioctl-types.h", ""}, - {"bits/ioctls.h", ""}, - {"bits/link.h", ""}, - {"bits/mqueue.h", ""}, - {"bits/netdb.h", ""}, - {"bits/param.h", ""}, - {"bits/poll.h", ""}, - {"bits/posix_opt.h", ""}, - {"bits/pthreadtypes.h", ""}, - {"bits/sched.h", ""}, - {"bits/select.h", ""}, - {"bits/semaphore.h", ""}, - {"bits/sigthread.h", ""}, - {"bits/sockaddr.h", ""}, - {"bits/socket.h", ""}, - {"bits/socket_type.h", ""}, - {"bits/stab.def", ""}, - {"bits/stat.h", ""}, - {"bits/stropts.h", ""}, - {"bits/syscall.h", ""}, - {"bits/syslog-path.h", ""}, - {"bits/termios.h", ""}, - {"bits/types.h", ""}, - {"bits/typesizes.h", ""}, - {"bits/uio.h", ""}, - {"bits/ustat.h", ""}, - {"bits/utmp.h", ""}, - {"bits/utmpx.h", ""}, - {"bits/waitflags.h", ""}, - {"bits/waitstatus.h", ""}, - {"bits/xtitypes.h", ""}, - }); + static const auto *SystemHeaderMap = GetHeaderMapping(); + // Check MaxSuffixComponents constant is correct. assert(llvm::all_of(SystemHeaderMap->keys(), [](llvm::StringRef Path) { return std::distance( - llvm::sys::path::begin(Path, llvm::sys::path::Style::posix), + llvm::sys::path::begin(Path, llvm::sys::path::Style::native), llvm::sys::path::end(Path)) <= MaxSuffixComponents; })); // ... and precise. assert(llvm::find_if(SystemHeaderMap->keys(), [](llvm::StringRef Path) { return std::distance(llvm::sys::path::begin( - Path, llvm::sys::path::Style::posix), + Path, llvm::sys::path::Style::native), llvm::sys::path::end(Path)) == MaxSuffixComponents; }) != SystemHeaderMap->keys().end()); - // FIXME: Suffix mapping contains invalid entries for C, so only enable it for - // CPP. + // Suffix mapping contains invalid entries for C, so only enable it for CPP. if (Language.CPlusPlus) StdSuffixHeaderMapping = SystemHeaderMap; } diff --git a/clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp b/clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp --- a/clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp +++ b/clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp @@ -100,10 +100,9 @@ // We added a mapping from some/path to . ASSERT_EQ("", CI.mapHeader(File)); // We should have a path from 'bits/stl_vector.h' to ''. - // FIXME: The Standrad Library map in CanonicalIncludes expects forward - // slashes and Windows would use backward slashes instead, so the headers are - // not matched appropriately. - auto STLVectorFile = addFile(*InMemFS, Files, "bits/stl_vector.h"); + SmallString<32> FileName("bits/stl_vector.h"); + llvm::sys::path::make_preferred(FileName); + auto STLVectorFile = addFile(*InMemFS, Files, FileName); ASSERT_EQ("", CI.mapHeader(STLVectorFile)); } diff --git a/clang-tools-extra/test/clang-apply-replacements/conflict.cpp b/clang-tools-extra/test/clang-apply-replacements/conflict.cpp --- a/clang-tools-extra/test/clang-apply-replacements/conflict.cpp +++ b/clang-tools-extra/test/clang-apply-replacements/conflict.cpp @@ -4,7 +4,8 @@ // RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/file3.yaml > %T/Inputs/conflict/file3.yaml // RUN: sed "s#\$(path)#%/S/Inputs/conflict#" %S/Inputs/conflict/expected.txt > %T/Inputs/conflict/expected.txt // RUN: not clang-apply-replacements %T/Inputs/conflict > %T/Inputs/conflict/output.txt 2>&1 -// RUN: diff -b %T/Inputs/conflict/output.txt %T/Inputs/conflict/expected.txt +// RUN: sed 's#\\#/#g' %T/Inputs/conflict/output.txt > %T/Inputs/conflict/output-u.txt +// RUN: diff -b %T/Inputs/conflict/output-u.txt %T/Inputs/conflict/expected.txt // // Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files even when there is a failure. // RUN: ls -1 %T/Inputs/conflict | FileCheck %s --check-prefix=YAML diff --git a/clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp b/clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp --- a/clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp +++ b/clang-tools-extra/test/clang-apply-replacements/order-dependent.cpp @@ -4,4 +4,5 @@ // RUN: sed "s#\$(path)#%/T/Inputs/order-dependent#" %S/Inputs/order-dependent/file2.yaml > %T/Inputs/order-dependent/file2.yaml // RUN: sed "s#\$(path)#%/T/Inputs/order-dependent#" %S/Inputs/order-dependent/expected.txt > %T/Inputs/order-dependent/expected.txt // RUN: not clang-apply-replacements %T/Inputs/order-dependent > %T/Inputs/order-dependent/output.txt 2>&1 -// RUN: diff -b %T/Inputs/order-dependent/output.txt %T/Inputs/order-dependent/expected.txt +// RUN: sed 's#\\#/#g' %T/Inputs/order-dependent/output.txt > %T/Inputs/order-dependent/output-u.txt +// RUN: diff -b %T/Inputs/order-dependent/output-u.txt %T/Inputs/order-dependent/expected.txt diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp @@ -6,7 +6,7 @@ // CHECK-NOT: warning: #include "absl/external-file.h" -// CHECK: absl/external-file.h:6:24: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil [abseil-no-internal-dependencies] +// CHECK: absl{{[/\\]}}external-file.h:6:24: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil [abseil-no-internal-dependencies] void DirectAcess() { absl::strings_internal::InternalFunction(); diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil-no-namespace.cpp @@ -7,7 +7,7 @@ /// Warning will be triggered on code that is not internal that is included. #include "absl/external-file.h" -// CHECK: absl/external-file.h:1:11: warning: namespace 'absl' is reserved +// CHECK: absl{{[/\\]}}external-file.h:1:11: warning: namespace 'absl' is reserved namespace absl {} // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: namespace 'absl' is reserved for implementation of the Abseil library and should not be opened in user code [abseil-no-namespace] diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp @@ -49,14 +49,14 @@ // CHECK-FIXES-ENABLED-NEXT: STYLE_SECOND_BAD(); // CHECK-FIXES-SHARED-NEXT: } -// CHECK-MESSAGES-DISABLED: global-style1/header.h:3:6: warning: invalid case style for function 'style_first_good' -// CHECK-MESSAGES-ENABLED: global-style1/header.h:5:6: warning: invalid case style for global function 'styleFirstBad' -// CHECK-MESSAGES-ENABLED: global-style1/header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeIgnored' -// CHECK-MESSAGES-DISABLED: global-style1/header.h:7:31: warning: invalid case style for parameter 'argc' -// CHECK-MESSAGES-DISABLED: global-style1/header.h:7:49: warning: invalid case style for parameter 'argv' - -// CHECK-MESSAGES-DISABLED: global-style2/header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD' -// CHECK-MESSAGES-ENABLED: global-style2/header.h:5:6: warning: invalid case style for global function 'styleSecondBad' -// CHECK-MESSAGES-ENABLED: global-style2/header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeNotIgnored' -// CHECK-MESSAGES-SHARED: global-style2/header.h:7:34: warning: invalid case style for parameter 'argc' -// CHECK-MESSAGES-SHARED: global-style2/header.h:7:52: warning: invalid case style for parameter 'argv' +// CHECK-MESSAGES-DISABLED: global-style1{{[/\\]}}header.h:3:6: warning: invalid case style for function 'style_first_good' +// CHECK-MESSAGES-ENABLED: global-style1{{[/\\]}}header.h:5:6: warning: invalid case style for global function 'styleFirstBad' +// CHECK-MESSAGES-ENABLED: global-style1{{[/\\]}}header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeIgnored' +// CHECK-MESSAGES-DISABLED: global-style1{{[/\\]}}header.h:7:31: warning: invalid case style for parameter 'argc' +// CHECK-MESSAGES-DISABLED: global-style1{{[/\\]}}header.h:7:49: warning: invalid case style for parameter 'argv' + +// CHECK-MESSAGES-DISABLED: global-style2{{[/\\]}}header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD' +// CHECK-MESSAGES-ENABLED: global-style2{{[/\\]}}header.h:5:6: warning: invalid case style for global function 'styleSecondBad' +// CHECK-MESSAGES-ENABLED: global-style2{{[/\\]}}header.h:7:5: warning: invalid case style for global function 'thisIsMainLikeNotIgnored' +// CHECK-MESSAGES-SHARED: global-style2{{[/\\]}}header.h:7:34: warning: invalid case style for parameter 'argc' +// CHECK-MESSAGES-SHARED: global-style2{{[/\\]}}header.h:7:52: warning: invalid case style for parameter 'argv' diff --git a/clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize b/clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize --- a/clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize +++ b/clang-tools-extra/test/modularize/ProblemsMissingHeader.modularize @@ -1,3 +1,3 @@ # RUN: not modularize %S/Inputs/MissingHeader/module.modulemap 2>&1 | FileCheck %s -# CHECK: {{.*}}{{[/\\]}}Inputs/MissingHeader/module.modulemap:8:10: error : Header not found: Missing.h +# CHECK: {{.*}}{{[/\\]}}Inputs{{[/\\]}}MissingHeader{{[/\\]}}module.modulemap:8:10: error : Header not found: Missing.h diff --git a/clang/bindings/python/tests/cindex/test_translation_unit.py b/clang/bindings/python/tests/cindex/test_translation_unit.py --- a/clang/bindings/python/tests/cindex/test_translation_unit.py +++ b/clang/bindings/python/tests/cindex/test_translation_unit.py @@ -85,7 +85,7 @@ int x; int SOME_DEFINE; """), - ('./fake.h', """ + ('fake.h', """ #define SOME_DEFINE y """) ]) diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -136,6 +136,13 @@ ++NumDirLookups; + SmallString<128> CleanDirName; + if (DirName.size() > 1) { + CleanDirName = DirName; + llvm::sys::path::remove_dots(CleanDirName); + DirName = CleanDirName; + } + // See if there was already an entry in the map. Note that the map // contains both virtual and real directories. auto SeenDirInsertResult = @@ -205,6 +212,11 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { ++NumFileLookups; + SmallString<128> CleanFilename = Filename; + // Explicitly not removing "../" because doing so can break symlinks. + llvm::sys::path::remove_dots(CleanFilename, /*remove_dot_dot=*/false); + Filename = CleanFilename; + // See if there is already an entry in the map. auto SeenFileInsertResult = SeenFileEntries.insert({Filename, std::errc::no_such_file_or_directory}); diff --git a/clang/test/ClangScanDeps/header-search-pruning-transitive.c b/clang/test/ClangScanDeps/header-search-pruning-transitive.c --- a/clang/test/ClangScanDeps/header-search-pruning-transitive.c +++ b/clang/test/ClangScanDeps/header-search-pruning-transitive.c @@ -37,6 +37,9 @@ //--- test.c #include "X.h" +// clang-format mangles this .c file in unreasonable ways. +// clang-format off + //--- cdb_with_a.json.template [{ "file": "DIR/test.c", @@ -72,8 +75,8 @@ // CHECK: ], // CHECK-NEXT: "context-hash": "[[HASH_X:.*]]", // CHECK-NEXT: "file-deps": [ -// CHECK-NEXT: "[[PREFIX]]/./X.h", -// CHECK-NEXT: "[[PREFIX]]/./module.modulemap" +// CHECK-NEXT: "[[PREFIX]]/X.h", +// CHECK-NEXT: "[[PREFIX]]/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "name": "X" // CHECK-NEXT: }, @@ -84,11 +87,11 @@ // CHECK: ], // CHECK-NEXT: "context-hash": "[[HASH_Y_WITH_A]]", // CHECK-NEXT: "file-deps": [ -// CHECK-NEXT: "[[PREFIX]]/./Y.h", -// CHECK-NEXT: "[[PREFIX]]/./a/a.h", -// CHECK-NEXT: "[[PREFIX]]/./begin/begin.h", -// CHECK-NEXT: "[[PREFIX]]/./end/end.h", -// CHECK-NEXT: "[[PREFIX]]/./module.modulemap" +// CHECK-NEXT: "[[PREFIX]]/Y.h", +// CHECK-NEXT: "[[PREFIX]]/a/a.h", +// CHECK-NEXT: "[[PREFIX]]/begin/begin.h", +// CHECK-NEXT: "[[PREFIX]]/end/end.h", +// CHECK-NEXT: "[[PREFIX]]/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "name": "Y" // CHECK-NEXT: } @@ -127,8 +130,8 @@ // also has a different context hash from the first version of module X. // CHECK-NOT: "context-hash": "[[HASH_X]]", // CHECK: "file-deps": [ -// CHECK-NEXT: "[[PREFIX]]/./X.h", -// CHECK-NEXT: "[[PREFIX]]/./module.modulemap" +// CHECK-NEXT: "[[PREFIX]]/X.h", +// CHECK-NEXT: "[[PREFIX]]/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "name": "X" // CHECK-NEXT: }, @@ -139,10 +142,10 @@ // CHECK: ], // CHECK-NEXT: "context-hash": "[[HASH_Y_WITHOUT_A]]", // CHECK-NEXT: "file-deps": [ -// CHECK-NEXT: "[[PREFIX]]/./Y.h", -// CHECK-NEXT: "[[PREFIX]]/./begin/begin.h", -// CHECK-NEXT: "[[PREFIX]]/./end/end.h", -// CHECK-NEXT: "[[PREFIX]]/./module.modulemap" +// CHECK-NEXT: "[[PREFIX]]/Y.h", +// CHECK-NEXT: "[[PREFIX]]/begin/begin.h", +// CHECK-NEXT: "[[PREFIX]]/end/end.h", +// CHECK-NEXT: "[[PREFIX]]/module.modulemap" // CHECK-NEXT: ], // CHECK-NEXT: "name": "Y" // CHECK-NEXT: } diff --git a/clang/test/Frontend/dependency-gen.c b/clang/test/Frontend/dependency-gen.c --- a/clang/test/Frontend/dependency-gen.c +++ b/clang/test/Frontend/dependency-gen.c @@ -16,7 +16,7 @@ // RUN: %clang -MD -MF - %s -fsyntax-only -I .//./a/b/ | FileCheck -check-prefix=CHECK-FOUR %s // CHECK-FOUR: {{ }}a{{[/\\]}}b{{[/\\]}}x.h // RUN: %clang -MD -MF - %s -fsyntax-only -I a/b/. | FileCheck -check-prefix=CHECK-FIVE %s -// CHECK-FIVE: {{ }}a{{[/\\]}}b{{[/\\]}}.{{[/\\]}}x.h +// CHECK-FIVE: {{ }}a{{[/\\]}}b{{[/\\]}}x.h // RUN: cd a/b // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s // CHECK-SIX: {{ }}x.h diff --git a/clang/test/Index/skip-parsed-bodies/compile_commands.json b/clang/test/Index/skip-parsed-bodies/compile_commands.json --- a/clang/test/Index/skip-parsed-bodies/compile_commands.json +++ b/clang/test/Index/skip-parsed-bodies/compile_commands.json @@ -1,73 +1,73 @@ [ -{ - "directory": ".", - "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t1.cpp", - "file": "t1.cpp" -}, -{ - "directory": ".", - "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t2.cpp -DBLAH", - "file": "t2.cpp" -}, -{ - "directory": ".", - "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t3.cpp -DBLAH", - "file": "t3.cpp" -} + { + "directory": ".", + "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t1.cpp", + "file": "t1.cpp" + }, + { + "directory": ".", + "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t2.cpp -DBLAH", + "file": "t2.cpp" + }, + { + "directory": ".", + "command": "/usr/bin/clang++ -fsyntax-only -fno-ms-compatibility -fno-delayed-template-parsing t3.cpp -DBLAH", + "file": "t3.cpp" + } ] -// RUN: c-index-test -index-compile-db %s | FileCheck %s + // RUN: c-index-test -index-compile-db %s | FileCheck %s -// CHECK: [startedTranslationUnit] -// CHECK-NEXT: [enteredMainFile]: t1.cpp -// CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 -// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:9:27 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: 1 -// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | -// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C | -// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:15:5 -// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 -// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:19:5 -// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val1' -// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2' -// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3' + // CHECK: [startedTranslationUnit] + // CHECK-NEXT: [enteredMainFile]: t1.cpp + // CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 + // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:9:27 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: 1 + // CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | + // CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C | + // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:15:5 + // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 + // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:19:5 + // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val1' + // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2' + // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3' -// CHECK-NEXT: [startedTranslationUnit] -// CHECK-NEXT: [enteredMainFile]: t2.cpp -// CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isContainer: skipped -// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | -// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C | -// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h -// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 -// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:25:5 -// CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 -// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./pragma_once.h:8:7 -// CHECK: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 -// CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./imported.h:4:5 -// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4' -// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval' -// CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval' + // CHECK-NEXT: [startedTranslationUnit] + // CHECK-NEXT: [enteredMainFile]: t2.cpp + // CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isContainer: skipped + // CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | + // CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C | + // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NEXT: [ppIncludedFile]: pragma_once.h + // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 + // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: t.h:25:5 + // CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 + // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: pragma_once.h:8:7 + // CHECK: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 + // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: imported.h:4:5 + // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val4' + // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval' + // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval' -// CHECK-NEXT: [startedTranslationUnit] -// CHECK-NEXT: [enteredMainFile]: t3.cpp -// CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 -// CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: skipped -// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | -// CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C | -// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NEXT: [ppIncludedFile]: ./pragma_once.h -// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: ./pragma_once.h:3:12 -// CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val | -// CHECK: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped -// CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val | -// CHECK-NOT: [diagnostic]: {{.*}} undeclared identifier + // CHECK-NEXT: [startedTranslationUnit] + // CHECK-NEXT: [enteredMainFile]: t3.cpp + // CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 + // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def2 | {{.*}} | isRedecl: 1 | isDef: 1 | isContainer: skipped + // CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | + // CHECK-NEXT: [indexEntityReference]: kind: c++-class | name: C | + // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NEXT: [ppIncludedFile]: pragma_once.h + // CHECK-NEXT: [indexDeclaration]: kind: function | name: foo2 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NEXT: [indexDeclaration]: kind: variable | {{.*}} | loc: pragma_once.h:3:12 + // CHECK: [indexDeclaration]: kind: c++-instance-method | name: tsmeth | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val | + // CHECK: [indexDeclaration]: kind: function | name: imp_foo | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped + // CHECK-NOT: [indexEntityReference]: kind: variable | name: some_val | + // CHECK-NOT: [diagnostic]: {{.*}} undeclared identifier diff --git a/clang/test/Modules/cxx20-hu-04.cpp b/clang/test/Modules/cxx20-hu-04.cpp --- a/clang/test/Modules/cxx20-hu-04.cpp +++ b/clang/test/Modules/cxx20-hu-04.cpp @@ -39,7 +39,7 @@ // expected-no-diagnostics // CHECK-HU: ====== C++20 Module structure ====== -// CHECK-HU-NEXT: Header Unit './hu-01.h' is the Primary Module at index #1 +// CHECK-HU-NEXT: Header Unit 'hu-01.h' is the Primary Module at index #1 //--- hu-02.h export import "hu-01.h"; @@ -73,11 +73,11 @@ } #endif -// CHECK-IMP: remark: importing module './hu-01.h' from 'hu-01.pcm' +// CHECK-IMP: remark: importing module 'hu-01.h' from 'hu-01.pcm' // CHECK-HU2: ====== C++20 Module structure ====== -// CHECK-HU2-NEXT: Header Unit './hu-02.h' is the Primary Module at index #2 +// CHECK-HU2-NEXT: Header Unit 'hu-02.h' is the Primary Module at index #2 // CHECK-HU2-NEXT: Exports: -// CHECK-HU2-NEXT: Header Unit './hu-01.h' is at index #1 +// CHECK-HU2-NEXT: Header Unit 'hu-01.h' is at index #1 // expected-no-diagnostics //--- importer-01.cpp @@ -101,5 +101,5 @@ return foo(FORTYTWO + x + KAP); } -// CHECK-IMP-HU2: remark: importing module './hu-02.h' from 'hu-02.pcm' -// CHECK-IMP-HU2: remark: importing module './hu-01.h' into './hu-02.h' from '[[TDIR]]{{[/\\]}}hu-01.pcm' +// CHECK-IMP-HU2: remark: importing module 'hu-02.h' from 'hu-02.pcm' +// CHECK-IMP-HU2: remark: importing module 'hu-01.h' into 'hu-02.h' from '[[TDIR]]{{[/\\]}}hu-01.pcm' diff --git a/clang/test/Modules/cxx20-hu-05.cpp b/clang/test/Modules/cxx20-hu-05.cpp --- a/clang/test/Modules/cxx20-hu-05.cpp +++ b/clang/test/Modules/cxx20-hu-05.cpp @@ -29,4 +29,4 @@ #endif // __GUARD // CHECK-HU: ====== C++20 Module structure ====== -// CHECK-HU-NEXT: Header Unit './hu-01.h' is the Primary Module at index #1 +// CHECK-HU-NEXT: Header Unit 'hu-01.h' is the Primary Module at index #1 diff --git a/clang/test/Modules/cxx20-hu-06.cpp b/clang/test/Modules/cxx20-hu-06.cpp --- a/clang/test/Modules/cxx20-hu-06.cpp +++ b/clang/test/Modules/cxx20-hu-06.cpp @@ -65,4 +65,4 @@ return FORTYTWO; } #endif -// CHECK-IMP: remark: importing module './hu-01.h' from 'hu-01.pcm' +// CHECK-IMP: remark: importing module 'hu-01.h' from 'hu-01.pcm' diff --git a/clang/test/Modules/filename.cpp b/clang/test/Modules/filename.cpp --- a/clang/test/Modules/filename.cpp +++ b/clang/test/Modules/filename.cpp @@ -5,4 +5,4 @@ // Make sure that headers that are referenced by module maps have __FILE__ // reflect the include path they were found with. -// CHECK: const char *p = "./Inputs/filename/a.h" +// CHECK: const char *p = "Inputs/filename/a.h" diff --git a/clang/unittests/Lex/HeaderSearchTest.cpp b/clang/unittests/Lex/HeaderSearchTest.cpp --- a/clang/unittests/Lex/HeaderSearchTest.cpp +++ b/clang/unittests/Lex/HeaderSearchTest.cpp @@ -112,6 +112,23 @@ } TEST_F(HeaderSearchTest, Dots) { + VFS->addFile("./inc/./foo.h", 0, nullptr, /*User=*/None, /*Group=*/None, + llvm::sys::fs::file_type::regular_file); + llvm::Expected FileRef = FileMgr.getFileRef("inc/foo.h", false); + assert(FileRef); + const auto *const FE = &FileRef->getFileEntry(); + EXPECT_EQ(StringRef(FileRef->getName()), StringRef("inc/foo.h")); + + FileRef = FileMgr.getFileRef("./inc/./foo.h", false); + assert(FileRef); + EXPECT_EQ(StringRef(FileRef->getName()), StringRef("inc/foo.h")); + EXPECT_EQ(FE, &FileRef->getFileEntry()); + + FileRef = FileMgr.getFileRef("inc/./foo.h", false); + assert(FileRef); + EXPECT_EQ(StringRef(FileRef->getName()), StringRef("inc/foo.h")); + EXPECT_EQ(FE, &FileRef->getFileEntry()); + addSearchDir("/x/./y/"); EXPECT_EQ(Search.suggestPathToFileForDiagnostics("/x/y/./z", /*WorkingDir=*/"", diff --git a/clang/unittests/Tooling/Syntax/TokensTest.cpp b/clang/unittests/Tooling/Syntax/TokensTest.cpp --- a/clang/unittests/Tooling/Syntax/TokensTest.cpp +++ b/clang/unittests/Tooling/Syntax/TokensTest.cpp @@ -295,7 +295,7 @@ {"int main() {}", R"(expanded tokens: int main ( ) { } -file './input.cpp' +file 'input.cpp' spelled tokens: int main ( ) { } no mappings. @@ -304,7 +304,7 @@ {"\t\n int\t\n main\t\n (\t\n )\t\n{\t\n }\t\n", R"(expanded tokens: int main ( ) { } -file './input.cpp' +file 'input.cpp' spelled tokens: int main ( ) { } no mappings. @@ -316,7 +316,7 @@ )cpp", R"(expanded tokens: -file './input.cpp' +file 'input.cpp' spelled tokens: # pragma GCC visibility push ( public ) # pragma GCC visibility pop mappings: @@ -325,7 +325,7 @@ // Empty files should not crash. {R"cpp()cpp", R"(expanded tokens: -file './input.cpp' +file 'input.cpp' spelled tokens: no mappings. @@ -339,7 +339,7 @@ )cpp", R"(expanded tokens: a -file './input.cpp' +file 'input.cpp' spelled tokens: a # define MACRO ( ) A # B mappings: @@ -404,7 +404,7 @@ std::string Expected = "expanded tokens:\n" " int a ;\n" - "file './input.cpp'\n" + "file 'input.cpp'\n" " spelled tokens:\n" " # define FOO a # include \"unresolved_file.h\" # undef FOO " "# ifdef X # else # endif # ifndef Y # endif # if 1 # elif 2 # else " @@ -423,7 +423,7 @@ )cpp", R"(expanded tokens: int const a ; -file './input.cpp' +file 'input.cpp' spelled tokens: # define INT int const INT a ; mappings: @@ -437,7 +437,7 @@ )cpp", R"(expanded tokens: const int a ; -file './input.cpp' +file 'input.cpp' spelled tokens: # define INT ( a ) const int INT ( 10 + 10 ) a ; mappings: @@ -452,7 +452,7 @@ )cpp", R"(expanded tokens: int const a ; -file './input.cpp' +file 'input.cpp' spelled tokens: # define ID ( X ) X # define INT int const ID ( ID ( INT ) ) a ; mappings: @@ -468,7 +468,7 @@ )cpp", "expanded tokens:\n" " int a = 1 * 2 + 3 * 4 + 5 ;\n" - "file './input.cpp'\n" + "file 'input.cpp'\n" " spelled tokens:\n" " # define ADD ( X , Y ) X + Y # define MULT ( X , Y ) X * Y int " "a = ADD ( MULT ( 1 , 2 ) , MULT ( 3 , ADD ( 4 , 5 ) ) ) ;\n" @@ -485,7 +485,7 @@ )cpp", R"(expanded tokens: -file './input.cpp' +file 'input.cpp' spelled tokens: # define EMPTY # define EMPTY_FUNC ( X ) EMPTY EMPTY_FUNC ( 1 + 2 + 3 ) mappings: @@ -500,7 +500,7 @@ )cpp", R"(expanded tokens: int a = 10 + 10 ; -file './input.cpp' +file 'input.cpp' spelled tokens: # define FOO 10 + 10 ; int a = FOO mappings: @@ -515,7 +515,7 @@ )cpp", R"(expanded tokens: 1 + 42 -file './input.cpp' +file 'input.cpp' spelled tokens: # define NUM 42 # define ID ( a ) a # define M 1 + ID M ( NUM ) mappings: @@ -604,19 +604,19 @@ std::string Expected = R"(expanded tokens: int a = 100 ; int b = 1 + 2 ; int c = 1 + 2 * 3 ; -file './input.cpp' +file 'input.cpp' spelled tokens: # include "foo.h" int c = ADD ( 1 , MULT ( 2 , 3 ) ) ; mappings: ['#'_0, 'int'_3) => ['int'_12, 'int'_12) ['ADD'_6, ';'_17) => ['1'_15, ';'_20) -file './foo.h' +file 'foo.h' spelled tokens: # define ADD ( X , Y ) X + Y int a = 100 ; # include "bar.h" mappings: ['#'_0, 'int'_11) => ['int'_0, 'int'_0) ['#'_16, ''_19) => ['int'_5, 'int'_5) -file './bar.h' +file 'bar.h' spelled tokens: int b = ADD ( 1 , 2 ) ; # define MULT ( X , Y ) X * Y mappings: diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp --- a/clang/unittests/Tooling/TransformerTest.cpp +++ b/clang/unittests/Tooling/TransformerTest.cpp @@ -1622,21 +1622,22 @@ return L.getFilePath() < R.getFilePath(); }); - ASSERT_EQ(Changes[0].getFilePath(), "./input.h"); - EXPECT_THAT(Changes[0].getInsertedHeaders(), IsEmpty()); - EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty()); + const auto &change_h = Changes[1]; + ASSERT_EQ(change_h.getFilePath(), "input.h"); + EXPECT_THAT(change_h.getInsertedHeaders(), IsEmpty()); + EXPECT_THAT(change_h.getRemovedHeaders(), IsEmpty()); llvm::Expected UpdatedCode = - clang::tooling::applyAllReplacements(Header, - Changes[0].getReplacements()); + clang::tooling::applyAllReplacements(Header, change_h.getReplacements()); ASSERT_TRUE(static_cast(UpdatedCode)) << "Could not update code: " << llvm::toString(UpdatedCode.takeError()); EXPECT_EQ(format(*UpdatedCode), ""); - ASSERT_EQ(Changes[1].getFilePath(), "input.cc"); - EXPECT_THAT(Changes[1].getInsertedHeaders(), IsEmpty()); - EXPECT_THAT(Changes[1].getRemovedHeaders(), IsEmpty()); - UpdatedCode = clang::tooling::applyAllReplacements( - Source, Changes[1].getReplacements()); + const auto &change_cc = Changes[0]; + ASSERT_EQ(change_cc.getFilePath(), "input.cc"); + EXPECT_THAT(change_cc.getInsertedHeaders(), IsEmpty()); + EXPECT_THAT(change_cc.getRemovedHeaders(), IsEmpty()); + UpdatedCode = + clang::tooling::applyAllReplacements(Source, change_cc.getReplacements()); ASSERT_TRUE(static_cast(UpdatedCode)) << "Could not update code: " << llvm::toString(UpdatedCode.takeError()); EXPECT_EQ(format(*UpdatedCode), format("#include \"input.h\"\n")); @@ -1659,7 +1660,7 @@ {{"input.h", Header}})); ASSERT_EQ(Changes.size(), 1U); - ASSERT_EQ(Changes[0].getFilePath(), "./input.h"); + ASSERT_EQ(Changes[0].getFilePath(), "input.h"); EXPECT_THAT(Changes[0].getInsertedHeaders(), ElementsAre("header.h")); EXPECT_THAT(Changes[0].getRemovedHeaders(), IsEmpty()); llvm::Expected UpdatedCode = @@ -1708,7 +1709,7 @@ ResultOf([](const AtomicChange &C) { return C.getFilePath(); }, "input.cc"), ResultOf([](const AtomicChange &C) { return C.getFilePath(); }, - "./input.h")))); + "input.h")))); } TEST_F(TransformerTest, GeneratesMetadata) {