[PATCH] D20465: [find-all-symbol] Ignore inline namespace context.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri May 20 05:11:12 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270206: [find-all-symbol] Ignore inline namespace context. (authored by hokein).
Changed prior to commit:
http://reviews.llvm.org/D20465?vs=57918&id=57925#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20465
Files:
clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
===================================================================
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
@@ -42,9 +42,9 @@
assert(llvm::isa<NamedDecl>(Context) &&
"Expect Context to be a NamedDecl");
if (const auto *NSD = dyn_cast<NamespaceDecl>(Context)) {
- Contexts.emplace_back(SymbolInfo::ContextType::Namespace,
- NSD->isAnonymousNamespace() ? ""
- : NSD->getName().str());
+ if (!NSD->isInlineNamespace())
+ Contexts.emplace_back(SymbolInfo::ContextType::Namespace,
+ NSD->getName().str());
} else if (const auto *ED = dyn_cast<EnumDecl>(Context)) {
Contexts.emplace_back(SymbolInfo::ContextType::EnumDecl,
ED->getName().str());
Index: clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -268,7 +268,8 @@
int X1;
namespace { int X2; }
namespace { namespace { int X3; } }
- namespace { namespace nb { int X4;} }
+ namespace { namespace nb { int X4; } }
+ namespace na { inline namespace __1 { int X5; } }
)";
runFindAllSymbols(Code);
@@ -289,6 +290,10 @@
{{SymbolInfo::ContextType::Namespace, "nb"},
{SymbolInfo::ContextType::Namespace, ""}});
EXPECT_TRUE(hasSymbol(Symbol));
+
+ Symbol = SymbolInfo("X5", SymbolInfo::SymbolKind::Variable, HeaderName, 6,
+ {{SymbolInfo::ContextType::Namespace, "na"}});
+ EXPECT_TRUE(hasSymbol(Symbol));
}
TEST_F(FindAllSymbolsTest, DecayedTypeTest) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20465.57925.patch
Type: text/x-patch
Size: 2102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160520/1145563a/attachment.bin>
More information about the cfe-commits
mailing list