r313653 - Fix ClangDiagnosticHandler::is*RemarkEnabled members
Adam Nemet via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 19 10:59:41 PDT 2017
Author: anemet
Date: Tue Sep 19 10:59:40 2017
New Revision: 313653
URL: http://llvm.org/viewvc/llvm-project?rev=313653&view=rev
Log:
Fix ClangDiagnosticHandler::is*RemarkEnabled members
Apparently these weren't really working. I added test coverage and fixed the
typo in the name and the parameter.
Added:
cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=313653&r1=313652&r2=313653&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Sep 19 10:59:40 2017
@@ -53,19 +53,20 @@ namespace clang {
: CodeGenOpts(CGOpts), BackendCon(BCon) {}
bool handleDiagnostics(const DiagnosticInfo &DI) override;
- bool isAnalysisRemarkEnable(const std::string &PassName) {
+
+ bool isAnalysisRemarkEnabled(StringRef PassName) const override {
return (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
CodeGenOpts.OptimizationRemarkAnalysisPattern->match(PassName));
}
- bool isMissedOptRemarkEnable(const std::string &PassName) {
+ bool isMissedOptRemarkEnabled(StringRef PassName) const override {
return (CodeGenOpts.OptimizationRemarkMissedPattern &&
CodeGenOpts.OptimizationRemarkMissedPattern->match(PassName));
}
- bool isPassedOptRemarkEnable(const std::string &PassName) {
+ bool isPassedOptRemarkEnabled(StringRef PassName) const override {
return (CodeGenOpts.OptimizationRemarkPattern &&
CodeGenOpts.OptimizationRemarkPattern->match(PassName));
}
-
+
private:
const CodeGenOptions &CodeGenOpts;
BackendConsumer *BackendCon;
Added: cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c?rev=313653&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c (added)
+++ cfe/trunk/test/Frontend/optimization-remark-extra-analysis.c Tue Sep 19 10:59:40 2017
@@ -0,0 +1,11 @@
+// Test that the is*RemarkEnabled overrides are working properly. This remark
+// requiring extra analysis is only conditionally enabled.
+
+// RUN: %clang_cc1 %s -Rpass-missed=gvn -O2 -emit-llvm-only -verify
+
+int foo(int *x, int *y) {
+ int a = *x;
+ *y = 2;
+ // expected-remark at +1 {{load of type i32 not eliminated}}
+ return a + *x;
+}
More information about the cfe-commits
mailing list