[find-all-symbols] Slim SymbolInfo.
Summary:
SymbolInfo has some optional fields, which is a bad-smell
implementation. For now, we
* remove the optional field since we don't need them (we can probably
add them back if we actually need them in the future)
* make SymbolInfo to be a class.
By this change, the code is more simplified.
Reviewers: klimek
Subscribers: cfe-commits, ioeric, bkramer
Differential Revision: http://reviews.llvm.org/D20095
llvm-svn: 269162
diff --git a/clang-tools-extra/include-fixer/XrefsDBManager.cpp b/clang-tools-extra/include-fixer/XrefsDBManager.cpp
index 9e30b62..90f6a80 100644
--- a/clang-tools-extra/include-fixer/XrefsDBManager.cpp
+++ b/clang-tools-extra/include-fixer/XrefsDBManager.cpp
@@ -36,13 +36,13 @@
std::vector<std::string> Results;
for (const auto &Symbol : Symbols) {
// Match the identifier name without qualifier.
- if (Symbol.Name == Names.back()) {
+ if (Symbol.getName() == Names.back()) {
bool IsMatched = true;
- auto SymbolContext = Symbol.Contexts.begin();
+ auto SymbolContext = Symbol.getContexts().begin();
// Match the remaining context names.
for (auto IdentiferContext = Names.rbegin() + 1;
IdentiferContext != Names.rend() &&
- SymbolContext != Symbol.Contexts.end();
+ SymbolContext != Symbol.getContexts().end();
++IdentiferContext, ++SymbolContext) {
if (SymbolContext->second != *IdentiferContext) {
IsMatched = false;
@@ -56,10 +56,10 @@
// need to be changed.
// FIXME: if the file path is a system header name, we want to use angle
// brackets.
- Results.push_back(
- (Symbol.FilePath[0] == '"' || Symbol.FilePath[0] == '<')
- ? Symbol.FilePath
- : "\"" + Symbol.FilePath + "\"");
+ std::string FilePath = Symbol.getFilePath().str();
+ Results.push_back((FilePath[0] == '"' || FilePath[0] == '<')
+ ? FilePath
+ : "\"" + FilePath + "\"");
}
}
}