summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-09-19 17:59:40 +0000
committerAdam Nemet <anemet@apple.com>2017-09-19 17:59:40 +0000
commit5d2eb16c9f0558e2f0d108949a6a12c4e4f01cde (patch)
tree6424f8097183803a087a442a839bfbdc4f55bf49
parentd327254b1b224091cba169811ec4b6fe31c830e2 (diff)
downloadbcm5719-llvm-5d2eb16c9f0558e2f0d108949a6a12c4e4f01cde.tar.gz
bcm5719-llvm-5d2eb16c9f0558e2f0d108949a6a12c4e4f01cde.zip
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. llvm-svn: 313653
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp9
-rw-r--r--clang/test/Frontend/optimization-remark-extra-analysis.c11
2 files changed, 16 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index a29e8de317f..3873ef4eb58 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -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;
diff --git a/clang/test/Frontend/optimization-remark-extra-analysis.c b/clang/test/Frontend/optimization-remark-extra-analysis.c
new file mode 100644
index 00000000000..1a8415e69cf
--- /dev/null
+++ b/clang/test/Frontend/optimization-remark-extra-analysis.c
@@ -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@+1 {{load of type i32 not eliminated}}
+ return a + *x;
+}
OpenPOWER on IntegriCloud