[PATCH] D143559: [Tooling/Inclusion] Use the StdSpecialSymbolMap.inc in the stdlib
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 9 15:04:47 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rG11dcd88577f4: [Tooling/Inclusion] Use the StdSpecialSymbolMap.inc in the stdlib (authored by hokein).
Changed prior to commit:
https://reviews.llvm.org/D143559?vs=495752&id=496251#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143559/new/
https://reviews.llvm.org/D143559
Files:
clang-tools-extra/clangd/index/CanonicalIncludes.cpp
clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp
clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
clang/unittests/Tooling/StandardLibraryTest.cpp
Index: clang/unittests/Tooling/StandardLibraryTest.cpp
===================================================================
--- clang/unittests/Tooling/StandardLibraryTest.cpp
+++ clang/unittests/Tooling/StandardLibraryTest.cpp
@@ -62,6 +62,16 @@
ElementsAre(stdlib::Header::named("<istream>"),
stdlib::Header::named("<iostream>"),
stdlib::Header::named("<iosfwd>")));
+ EXPECT_THAT(stdlib::Symbol::named("std::", "size_t")->headers(),
+ ElementsAre(stdlib::Header::named("<cstddef>"),
+ stdlib::Header::named("<cstdlib>"),
+ stdlib::Header::named("<cstring>"),
+ stdlib::Header::named("<cwchar>"),
+ stdlib::Header::named("<cuchar>"),
+ stdlib::Header::named("<ctime>"),
+ stdlib::Header::named("<cstdio>")));
+ EXPECT_EQ(stdlib::Symbol::named("std::", "size_t")->header(),
+ stdlib::Header::named("<cstddef>"));
EXPECT_THAT(stdlib::Header::all(), Contains(*VectorH));
EXPECT_THAT(stdlib::Symbol::all(), Contains(*Vector));
Index: clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
===================================================================
--- clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
+++ 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
Index: clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp
+++ clang-tools-extra/clangd/unittests/CanonicalIncludesTests.cpp
@@ -51,6 +51,7 @@
EXPECT_EQ("<cstdio>", CI.mapSymbol("std::", "printf", Language));
// std::move is ambiguous, currently always mapped to <utility>
EXPECT_EQ("<utility>", CI.mapSymbol("std::", "move", Language));
+ EXPECT_EQ("<cstddef>", 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.
Index: clang-tools-extra/clangd/index/CanonicalIncludes.cpp
===================================================================
--- clang-tools-extra/clangd/index/CanonicalIncludes.cpp
+++ 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 "<utility>";
- if (Scope == "std::" && Name == "size_t")
- return "<cstddef>";
if (auto StdSym = tooling::stdlib::Symbol::named(Scope, Name, Lang))
return StdSym->header().name();
return "";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143559.496251.patch
Type: text/x-patch
Size: 3028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230209/5bd5bc37/attachment-0001.bin>
More information about the cfe-commits
mailing list