[PATCH] D69762: [LegacyPassManager] Fixed "null check after derefencing" warning
Dávid Bolvanský via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 3 07:37:02 PST 2019
xbolva00 created this revision.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, mehdi_amini.
Herald added projects: clang, LLVM.
The 'RequiredPass' pointer was utilized before it was verified against nullptr. Check lines: 1626, 1629.
[Diagnostics] Try to improve warning message for -Wreturn-type
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69762
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
llvm/lib/IR/LegacyPassManager.cpp
Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -1626,13 +1626,12 @@
/// RequiredPass is run on the fly by Pass Manager when P requests it
/// through getAnalysis interface.
void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
+ assert(RequiredPass && "No required pass?");
assert(P->getPotentialPassManagerType() == PMT_ModulePassManager &&
"Unable to handle Pass that requires lower level Analysis pass");
assert((P->getPotentialPassManagerType() <
RequiredPass->getPotentialPassManagerType()) &&
"Unable to handle Pass that requires lower level Analysis pass");
- if (!RequiredPass)
- return;
FunctionPassManagerImpl *FPP = OnTheFlyManagers[P];
if (!FPP) {
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -576,10 +576,10 @@
"thread-local storage is not supported for the current target">;
def warn_maybe_falloff_nonvoid_function : Warning<
- "control may reach end of non-void function">,
+ "not all control paths in this function return a value; non-void function must return a value">,
InGroup<ReturnType>;
def warn_falloff_nonvoid_function : Warning<
- "control reaches end of non-void function">,
+ "function does not return a value; non-void function must return a value">,
InGroup<ReturnType>;
def err_maybe_falloff_nonvoid_block : Error<
"control may reach end of non-void block">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69762.227609.patch
Type: text/x-patch
Size: 1715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191103/53f97241/attachment.bin>
More information about the cfe-commits
mailing list