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 @@ -716,8 +716,6 @@ // There are two std::move()s, this is by far the most common. if (Scope == "std::" && Name == "move") return ""; - if (Scope == "std::" && Name == "size_t") - return ""; if (auto StdSym = tooling::stdlib::Symbol::named(Scope, Name, Lang)) return StdSym->header().name(); return ""; 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 @@ -51,6 +51,7 @@ EXPECT_EQ("", CI.mapSymbol("std::", "printf", Language)); // std::move is ambiguous, currently always mapped to EXPECT_EQ("", CI.mapSymbol("std::", "move", Language)); + EXPECT_EQ("", CI.mapSymbol("std::", "size_t", Language)); // Unknown std symbols aren't mapped. EXPECT_EQ("", CI.mapSymbol("std::", "notathing", Language)); // iosfwd declares some symbols it doesn't own. diff --git a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp --- a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp +++ b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp @@ -62,6 +62,7 @@ break; case Lang::CXX: #include "StdSymbolMap.inc" +#include "StdSpecialSymbolMap.inc" break; } #undef SYMBOL @@ -130,6 +131,7 @@ break; case Lang::CXX: #include "StdSymbolMap.inc" +#include "StdSpecialSymbolMap.inc" break; } #undef SYMBOL diff --git a/clang/unittests/Tooling/StandardLibraryTest.cpp b/clang/unittests/Tooling/StandardLibraryTest.cpp --- a/clang/unittests/Tooling/StandardLibraryTest.cpp +++ b/clang/unittests/Tooling/StandardLibraryTest.cpp @@ -62,6 +62,16 @@ ElementsAre(stdlib::Header::named(""), stdlib::Header::named(""), stdlib::Header::named(""))); + EXPECT_THAT(stdlib::Symbol::named("std::", "size_t")->headers(), + ElementsAre(stdlib::Header::named(""), + stdlib::Header::named(""), + stdlib::Header::named(""), + stdlib::Header::named(""), + stdlib::Header::named(""), + stdlib::Header::named(""), + stdlib::Header::named(""))); + EXPECT_EQ(stdlib::Symbol::named("std::", "size_t")->header(), + stdlib::Header::named("")); EXPECT_THAT(stdlib::Header::all(), Contains(*VectorH)); EXPECT_THAT(stdlib::Symbol::all(), Contains(*Vector));