forked from qt-creator/qt-creator
Clang: Fix/silence some coverty issues
clangcompletionassistprocessor.cpp: 136 CID 1475671: Possible Control flow issues (DEADCODE) Execution cannot reach the expression "codeCompletion.completionKind != ClangBackEnd::CodeCompletion::SlotCompletionKind" inside this statement: "if (slotCompletion && codeC...". clangbackendcommunicator.cpp: 272 CID 1475649: Null pointer dereferences (NULL_RETURNS) Dereferencing a pointer that might be null "document" when calling "contents". (The dereference happens because this is a virtual function call.) clangutils.cpp: 335 CID 1475678: Error handling issues (CHECKED_RETURN) Calling "open" without checking return value (as is done elsewhere 144 out of 158 times). codecompletionsextractor.cpp: 48 CID 1475676: Uninitialized members (UNINIT_CTOR) Non-static class member field "currentCxCodeCompleteResult.CompletionString" is not initialized in this constructor nor in any functions that it calls. Change-Id: I4c8767ee6e824ba1c42d2f8914ad66dc95ac6717 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -332,7 +332,9 @@ void generateCompilationDB(::Utils::FileName projectDir, CppTools::ProjectInfo p
|
||||
{
|
||||
QFile compileCommandsFile(projectDir.toString() + "/compile_commands.json");
|
||||
|
||||
compileCommandsFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||
const bool fileOpened = compileCommandsFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||
if (!fileOpened)
|
||||
return;
|
||||
compileCommandsFile.write("[");
|
||||
for (ProjectPart::Ptr projectPart : projectInfo.projectParts()) {
|
||||
const ::Utils::FileName buildDir = buildDirectory(*projectPart);
|
||||
|
||||
Reference in New Issue
Block a user