[clang] a052bac - [clang][deps] NFC: Extract ModuleName initialization
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 10 03:44:44 PDT 2021
Author: Jan Svoboda
Date: 2021-09-10T12:44:39+02:00
New Revision: a052bacc766f25fe9a765dd4710c83f1683c059e
URL: https://github.com/llvm/llvm-project/commit/a052bacc766f25fe9a765dd4710c83f1683c059e
DIFF: https://github.com/llvm/llvm-project/commit/a052bacc766f25fe9a765dd4710c83f1683c059e.diff
LOG: [clang][deps] NFC: Extract ModuleName initialization
Added:
Modified:
clang/tools/clang-scan-deps/ClangScanDeps.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 8f8906d89a66..6595efa182ce 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -544,22 +544,19 @@ int main(int argc, const char **argv) {
Filename = std::move(Input->Filename);
CWD = std::move(Input->Directory);
}
+ Optional<StringRef> MaybeModuleName;
+ if (!ModuleName.empty())
+ MaybeModuleName = ModuleName;
// Run the tool on it.
if (Format == ScanningOutputFormat::Make) {
auto MaybeFile = WorkerTools[I]->getDependencyFile(
- Input->CommandLine, CWD,
- ModuleName.empty()
- ? None
- : llvm::Optional<StringRef>(ModuleName.c_str()));
+ Input->CommandLine, CWD, MaybeModuleName);
if (handleMakeDependencyToolResult(Filename, MaybeFile, DependencyOS,
Errs))
HadErrors = true;
} else {
auto MaybeFullDeps = WorkerTools[I]->getFullDependencies(
- Input->CommandLine, CWD, AlreadySeenModules,
- ModuleName.empty()
- ? None
- : llvm::Optional<StringRef>(ModuleName.c_str()));
+ Input->CommandLine, CWD, AlreadySeenModules, MaybeModuleName);
if (handleFullDependencyToolResult(Filename, MaybeFullDeps, FD,
LocalIndex, DependencyOS, Errs))
HadErrors = true;
More information about the cfe-commits
mailing list