From 8c7c1f11ffaacf762e612c65440fd2cbb58ee426 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 23 Mar 2023 14:41:03 +0100 Subject: [PATCH] Silence unused variable warning in NDEBUG builds 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index f2b2d0b..44c8723 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -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; -- 2.7.4