[clang-tools-extra] r369065 - [clang-doc] Fix use of source-root flag
Diego Astiazaran via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 15 16:20:43 PDT 2019
Author: diegoastiazaran
Date: Thu Aug 15 16:20:42 2019
New Revision: 369065
URL: http://llvm.org/viewvc/llvm-project?rev=369065&view=rev
Log:
[clang-doc] Fix use of source-root flag
The value, if any, of --source-root flag was not being used.
This has been fixed and the logic was moved to the ClangDocContext
contructor.
Differential revision: https://reviews.llvm.org/D66268
Modified:
clang-tools-extra/trunk/clang-doc/Representation.cpp
clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
Modified: clang-tools-extra/trunk/clang-doc/Representation.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/Representation.cpp?rev=369065&r1=369064&r2=369065&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-doc/Representation.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/Representation.cpp Thu Aug 15 16:20:42 2019
@@ -257,8 +257,12 @@ ClangDocContext::ClangDocContext(tooling
std::vector<std::string> UserStylesheets,
std::vector<std::string> JsScripts)
: ECtx(ECtx), PublicOnly(PublicOnly), OutDirectory(OutDirectory),
- SourceRoot(SourceRoot), UserStylesheets(UserStylesheets),
- JsScripts(JsScripts) {
+ UserStylesheets(UserStylesheets), JsScripts(JsScripts) {
+ llvm::SmallString<128> SourceRootDir(SourceRoot);
+ if (SourceRoot.empty())
+ // If no SourceRoot was provided the current path is used as the default
+ llvm::sys::fs::current_path(SourceRootDir);
+ this->SourceRoot = SourceRootDir.str();
if (!RepositoryUrl.empty()) {
this->RepositoryUrl = RepositoryUrl;
if (!RepositoryUrl.empty() && RepositoryUrl.find("http://") != 0 &&
Modified: clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp?rev=369065&r1=369064&r2=369065&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp (original)
+++ clang-tools-extra/trunk/clang-doc/tool/ClangDocMain.cpp Thu Aug 15 16:20:42 2019
@@ -203,17 +203,11 @@ int main(int argc, const char **argv) {
tooling::ArgumentInsertPosition::END),
ArgAdjuster);
- llvm::SmallString<128> SourceRootDir;
- // Check if the --source-root flag has a value
- if (SourceRoot.empty())
- // If it's empty the current path is used as the default
- llvm::sys::fs::current_path(SourceRootDir);
-
clang::doc::ClangDocContext CDCtx = {
Exec->get()->getExecutionContext(),
PublicOnly,
OutDirectory,
- SourceRootDir.str(),
+ SourceRoot,
RepositoryUrl,
{UserStylesheets.begin(), UserStylesheets.end()},
{"index.js", "index_json.js"}};
More information about the cfe-commits
mailing list