Skip to content

Commit

Permalink
Silence unused variable warning in NDEBUG builds
Browse files Browse the repository at this point in the history
I usually would fold this into the assert, but the comment there
suggests side effects. NFC.

ModuleMap.cpp:938:9: error: unused variable 'MainFile' [-Werror,-Wunused-variable]
  auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
  • Loading branch information
d0k committed Mar 23, 2023
1 parent 320969f commit 8c7c1f1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/Lex/ModuleMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ Module *ModuleMap::createModuleForImplementationUnit(SourceLocation Loc,
// Mark the main source file as being within the newly-created module so that
// declarations and macros are properly visibility-restricted to it.
auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
(void)MainFile;
assert(MainFile && "no input file for module implementation");

return Result;
Expand Down

0 comments on commit 8c7c1f1

Please sign in to comment.