[llvm] r290400 - Enable '-Wstring-conversion' and fix some bad asserts that it helped
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 17:38:06 PST 2016
Author: chandlerc
Date: Thu Dec 22 19:38:06 2016
New Revision: 290400
URL: http://llvm.org/viewvc/llvm-project?rev=290400&view=rev
Log:
Enable '-Wstring-conversion' and fix some bad asserts that it helped
find.
Notable is the assert in NewGVN which had no effect because of the bug.
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=290400&r1=290399&r2=290400&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Dec 22 19:38:06 2016
@@ -454,6 +454,9 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE
if (NOT C_WCOMMENT_ALLOWS_LINE_WRAP)
append("-Wno-comment" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
+
+ # Enable -Wstring-conversion to catch misuse of string literals.
+ add_flag_if_supported("-Wstring-conversion" STRING_CONVERSION_FLAG)
endif (LLVM_ENABLE_WARNINGS)
append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
add_flag_if_supported("-Werror=date-time" WERROR_DATE_TIME)
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp?rev=290400&r1=290399&r2=290400&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp Thu Dec 22 19:38:06 2016
@@ -45,7 +45,7 @@ public:
}
void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
MCInst &Res) const override {
- assert(!"Not implemented");
+ llvm_unreachable("Not implemented");
}
bool mayNeedRelaxation(const MCInst &Inst) const override { return false; }
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=290400&r1=290399&r2=290400&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Thu Dec 22 19:38:06 2016
@@ -1487,7 +1487,7 @@ void NewGVN::convertDenseToDFSOrdered(Co
BasicBlock *BB = getBlockForValue(D);
// Constants are handled prior to ever calling this function, so
// we should only be left with instructions as members.
- assert(BB || "Should have figured out a basic block for value");
+ assert(BB && "Should have figured out a basic block for value");
ValueDFS VD;
std::pair<int, int> DFSPair = DFSDomMap[BB];
More information about the llvm-commits
mailing list