[PATCH] D20158: [find-all-symbols] Save relative file path for each symbol.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 04:56:25 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL269173: [find-all-symbols] Save relative file path for each symbol. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D20158?vs=56879&id=56881#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20158

Files:
  clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
  clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h

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
@@ -17,7 +17,6 @@
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
 
 using namespace clang::ast_matchers;
 
@@ -76,21 +75,7 @@
   if (FilePath.empty())
     return llvm::None;
 
-  llvm::SmallString<128> AbsolutePath;
-  if (llvm::sys::path::is_absolute(FilePath)) {
-    AbsolutePath = FilePath;
-  } else {
-    auto WorkingDir = SM.getFileManager()
-                          .getVirtualFileSystem()
-                          ->getCurrentWorkingDirectory();
-    if (!WorkingDir)
-      return llvm::None;
-    AbsolutePath = *WorkingDir;
-    llvm::sys::path::append(AbsolutePath, FilePath);
-  }
-
-  llvm::sys::path::remove_dots(AbsolutePath, true);
-  return SymbolInfo(ND->getNameAsString(), Type, AbsolutePath.str(),
+  return SymbolInfo(ND->getNameAsString(), Type, FilePath.str(),
                     GetContexts(ND), SM.getExpansionLineNumber(Loc));
 }
 
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
===================================================================
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
@@ -55,7 +55,7 @@
   /// \brief Get symbol type.
   SymbolKind getSymbolKind() const;
 
-  /// \brief Get the file path where symbol comes from
+  /// \brief Get a relative file path where symbol comes from.
   llvm::StringRef getFilePath() const;
 
   /// \brief Get symbol contexts.
@@ -77,7 +77,8 @@
   /// \brief Symbol type.
   SymbolKind Type;
 
-  /// \brief The file path where the symbol comes from.
+  /// \brief The file path where the symbol comes from. It's a relative file
+  /// path based on the build directory.
   std::string FilePath;
 
   /// \brief Contains information about symbol contexts. Context information is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20158.56881.patch
Type: text/x-patch
Size: 2188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160511/1f8c699c/attachment-0001.bin>


More information about the cfe-commits mailing list