[PATCH] D93981: Fix some compiler warnings
Sanjoy Das (Work Account) via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 2 22:27:33 PST 2021
sanjoy.google created this revision.
sanjoy.google added a reviewer: rriddle.
Herald added subscribers: teijeong, dexonsmith, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, mehdi_amini.
sanjoy.google requested review of this revision.
Herald added subscribers: stephenneuendorffer, nicolasvasilache.
Herald added projects: MLIR, LLVM.
In particular:
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp:247:2: warning: extra ‘;’ [-Wpedantic]
247 | };
| ^
/usr/local/google/home/sanjoy/Code/llvm-project/llvm/unittests/Support/CrashRecoveryTest.cpp: In member function ‘virtual void CrashRecoveryTest_LimitedStackTrace_Test::TestBody()’:
/usr/local/google/home/sanjoy/Code/llvm-project/llvm/unittests/Support/CrashRecoveryTest.cpp:112:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
112 | if (!Triple(sys::getProcessTriple()).isOSWindows())
| ^
In file included from /usr/local/google/home/sanjoy/Code/llvm-project/llvm/unittests/Support/TaskQueueTest.cpp:13:
/usr/local/google/home/sanjoy/Code/llvm-project/llvm/include/llvm/Support/TaskQueue.h: In instantiation of ‘std::future<typename std::result_of<Callable()>::type> llvm::TaskQueue::async(Callable&&) [with Callable = TaskQueueTest_OrderedFutures_Test::TestBody()::<lambda()>; typename std::result_of<Callable()>::type = void]’:
/usr/local/google/home/sanjoy/Code/llvm-project/llvm/unittests/Support/TaskQueueTest.cpp:39:4: required from here
/usr/local/google/home/sanjoy/Code/llvm-project/llvm/include/llvm/Support/TaskQueue.h:101:23: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
101 | return std::move(F);
| ^
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/tools/mlir-tblgen/OpFormatGen.cpp: In member function ‘void {anonymous}::OperationFormat::genElementPrinter({anonymous}::Element*, mlir::tblgen::OpMethodBody&, mlir::tblgen::Operator&, bool&, bool&)’:
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/tools/mlir-tblgen/OpFormatGen.cpp:1644:23: warning: unused variable ‘newline’ [-Wunused-variable]
1644 | if (NewlineElement *newline = dyn_cast<NewlineElement>(element)) {
| ^~~~~~~
In file included from /usr/local/google/home/sanjoy/Code/llvm-project/mlir/lib/Parser/Lexer.h:17,
from /usr/local/google/home/sanjoy/Code/llvm-project/mlir/lib/Parser/ParserState.h:12,
from /usr/local/google/home/sanjoy/Code/llvm-project/mlir/lib/Parser/Parser.h:12,
from /usr/local/google/home/sanjoy/Code/llvm-project/mlir/lib/Parser/LocationParser.cpp:9:
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/include/mlir/Parser.h: In instantiation of ‘mlir::OwningOpRef<ContainerOpT> mlir::detail::constructContainerOpForParserIfNecessary(mlir::Block*, mlir::MLIRContext*, mlir::Location) [with ContainerOpT = mlir::ModuleOp]’:
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/include/mlir/Parser.h:134:72: required from ‘mlir::OwningOpRef<ContainerOpT> mlir::parseSourceFile(const llvm::SourceMgr&, mlir::MLIRContext*) [with ContainerOpT = mlir::ModuleOp]’
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/include/mlir/Parser.h:201:54: required from here
/usr/local/google/home/sanjoy/Code/llvm-project/mlir/include/mlir/Parser.h:70:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
70 | return std::move(opRef);
| ^
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93981
Files:
llvm/include/llvm/Support/TaskQueue.h
llvm/unittests/Support/CrashRecoveryTest.cpp
mlir/include/mlir/Parser.h
mlir/tools/mlir-tblgen/OpFormatGen.cpp
mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
Index: mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
+++ mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
@@ -244,7 +244,7 @@
"is", "lambda", "nonlocal", "not", "or", "pass",
"raise", "return", "try", "while", "with", "yield"});
return keywords.contains(str);
-};
+}
/// Checks whether `str` would shadow a generated variable or attribute
/// part of the OpView API.
Index: mlir/tools/mlir-tblgen/OpFormatGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -1641,7 +1641,7 @@
lastWasPunctuation);
// Emit a whitespace element.
- if (NewlineElement *newline = dyn_cast<NewlineElement>(element)) {
+ if (isa<NewlineElement>(element)) {
body << " p.printNewline();\n";
return;
}
Index: mlir/include/mlir/Parser.h
===================================================================
--- mlir/include/mlir/Parser.h
+++ mlir/include/mlir/Parser.h
@@ -67,7 +67,7 @@
// contain the operations inside of it.
if (failed(op.verify()))
return OwningOpRef<ContainerOpT>();
- return std::move(opRef);
+ return opRef;
}
} // end namespace detail
Index: llvm/unittests/Support/CrashRecoveryTest.cpp
===================================================================
--- llvm/unittests/Support/CrashRecoveryTest.cpp
+++ llvm/unittests/Support/CrashRecoveryTest.cpp
@@ -109,8 +109,9 @@
std::string Str = RawStream.str();
// FIXME: Handle "Depth" parameter in PrintStackTrace() function
// to print stack trace upto a specified Depth.
- if (!Triple(sys::getProcessTriple()).isOSWindows())
+ if (!Triple(sys::getProcessTriple()).isOSWindows()) {
EXPECT_EQ(std::string::npos, Str.find("#1"));
+ }
}
#ifdef _WIN32
Index: llvm/include/llvm/Support/TaskQueue.h
===================================================================
--- llvm/include/llvm/Support/TaskQueue.h
+++ llvm/include/llvm/Support/TaskQueue.h
@@ -98,7 +98,7 @@
IsTaskInFlight = true;
}
}
- return std::move(F);
+ return F;
}
private:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93981.314266.patch
Type: text/x-patch
Size: 2269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210103/7fa7c20b/attachment.bin>
More information about the llvm-commits
mailing list