summaryrefslogtreecommitdiffstats
path: root/Source/cmGccDepfileReader.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-02 16:11:19 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-13 14:18:02 (GMT)
commit946adadd404a160b708e96e668be9b84c949de69 (patch)
tree0dab12b9e989a076b1d347ca032d169b1ff2d027 /Source/cmGccDepfileReader.cxx
parenta1988e4c80a7c75f216814c5827796e976c25605 (diff)
downloadCMake-946adadd404a160b708e96e668be9b84c949de69.zip
CMake-946adadd404a160b708e96e668be9b84c949de69.tar.gz
CMake-946adadd404a160b708e96e668be9b84c949de69.tar.bz2
cmGccDepfileReader: Rework helper code
Fix some of the semantics of the depfile, add error handling, and refactor cmGccDepfileLexerHelper.
Diffstat (limited to 'Source/cmGccDepfileReader.cxx')
-rw-r--r--Source/cmGccDepfileReader.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx
index 9d70ede..eb3511a 100644
--- a/Source/cmGccDepfileReader.cxx
+++ b/Source/cmGccDepfileReader.cxx
@@ -5,14 +5,15 @@
#include <type_traits>
#include <utility>
+#include <cm/optional>
+
#include "cmGccDepfileLexerHelper.h"
-cmGccDepfileContent cmReadGccDepfile(const char* filePath)
+cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath)
{
- cmGccDepfileContent result;
cmGccDepfileLexerHelper helper;
if (helper.readFile(filePath)) {
- result = std::move(helper).extractContent();
+ return cm::make_optional(std::move(helper).extractContent());
}
- return result;
+ return cm::nullopt;
}