diff options
author | Davide Italiano <davide@freebsd.org> | 2016-03-02 06:09:18 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2016-03-02 06:09:18 +0000 |
commit | 75df82167085a6faee8c3e27db2e294f49df23b1 (patch) | |
tree | 6c4dd86c2778a7e781475446aa444b920647a4e2 | |
parent | a267431fa646fb77c1b6d045b2e70513cecadd2d (diff) | |
download | bcm5719-llvm-75df82167085a6faee8c3e27db2e294f49df23b1.tar.gz bcm5719-llvm-75df82167085a6faee8c3e27db2e294f49df23b1.zip |
[modules] addHeaderInclude() can't fail.
Differential Revision: http://reviews.llvm.org/D17794
llvm-svn: 262463
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 6f76aa0992d..c6e6a518a28 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -152,10 +152,10 @@ operator+=(SmallVectorImpl<char> &Includes, StringRef RHS) { return Includes; } -static std::error_code addHeaderInclude(StringRef HeaderName, - SmallVectorImpl<char> &Includes, - const LangOptions &LangOpts, - bool IsExternC) { +static void addHeaderInclude(StringRef HeaderName, + SmallVectorImpl<char> &Includes, + const LangOptions &LangOpts, + bool IsExternC) { if (IsExternC && LangOpts.CPlusPlus) Includes += "extern \"C\" {\n"; if (LangOpts.ObjC1) @@ -168,7 +168,6 @@ static std::error_code addHeaderInclude(StringRef HeaderName, Includes += "\"\n"; if (IsExternC && LangOpts.CPlusPlus) Includes += "}\n"; - return std::error_code(); } /// \brief Collect the set of header includes needed to construct the given @@ -194,22 +193,17 @@ collectModuleHeaderIncludes(const LangOptions &LangOpts, FileManager &FileMgr, // file relative to the module build directory (the directory containing // the module map file) so this will find the same file that we found // while parsing the module map. - if (std::error_code Err = addHeaderInclude(H.NameAsWritten, Includes, - LangOpts, Module->IsExternC)) - return Err; + addHeaderInclude(H.NameAsWritten, Includes, LangOpts, Module->IsExternC); } } // Note that Module->PrivateHeaders will not be a TopHeader. if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader()) { Module->addTopHeader(UmbrellaHeader.Entry); - if (Module->Parent) { + if (Module->Parent) // Include the umbrella header for submodules. - if (std::error_code Err = addHeaderInclude(UmbrellaHeader.NameAsWritten, - Includes, LangOpts, - Module->IsExternC)) - return Err; - } + addHeaderInclude(UmbrellaHeader.NameAsWritten, Includes, LangOpts, + Module->IsExternC); } else if (Module::DirectoryName UmbrellaDir = Module->getUmbrellaDir()) { // Add all of the headers we find in this subdirectory. std::error_code EC; @@ -248,9 +242,7 @@ collectModuleHeaderIncludes(const LangOptions &LangOpts, FileManager &FileMgr, // Include this header as part of the umbrella directory. Module->addTopHeader(Header); - if (std::error_code Err = addHeaderInclude(RelativeHeader, Includes, - LangOpts, Module->IsExternC)) - return Err; + addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC); } if (EC) @@ -356,10 +348,9 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI, SmallString<256> HeaderContents; std::error_code Err = std::error_code(); if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader()) - Err = addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents, - CI.getLangOpts(), Module->IsExternC); - if (!Err) - Err = collectModuleHeaderIncludes( + addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents, + CI.getLangOpts(), Module->IsExternC); + Err = collectModuleHeaderIncludes( CI.getLangOpts(), FileMgr, CI.getPreprocessor().getHeaderSearchInfo().getModuleMap(), Module, HeaderContents); |