Silence unused variable warning in NDEBUG builds
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 23 Mar 2023 13:41:03 +0000 (14:41 +0100)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 23 Mar 2023 13:41:03 +0000 (14:41 +0100)
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());

clang/lib/Lex/ModuleMap.cpp

index f2b2d0b..44c8723 100644 (file)
@@ -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;