summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test
diff options
context:
space:
mode:
authorElizabeth Andrews <elizabeth.andrews@intel.com>2019-12-03 14:20:52 -0800
committerElizabeth Andrews <elizabeth.andrews@intel.com>2019-12-03 15:27:19 -0800
commit878a24ee244a24c39d1c57e9af2e88c621f7cce9 (patch)
treee25f6be59d4eafb4294c3751aad095a86f9f2854 /clang-tools-extra/test
parentf139ae3d9379746164e8056c45817041417dfd4c (diff)
downloadbcm5719-llvm-878a24ee244a24c39d1c57e9af2e88c621f7cce9.tar.gz
bcm5719-llvm-878a24ee244a24c39d1c57e9af2e88c621f7cce9.zip
Reapply "Fix crash on switch conditions of non-integer types in templates"
This patch reapplies commit 759948467ea. Patch was reverted due to a clang-tidy test fail on Windows. The test has been modified. There are no additional code changes. Patch was tested with ninja check-all on Windows and Linux. Summary of code changes: Clang currently crashes for switch statements inside a template when the condition is a non-integer field member because contextual implicit conversion is skipped when parsing the condition. This conversion is however later checked in an assert when the case statement is handled. The conversion is skipped when parsing the condition because the field member is set as type-dependent based on its containing class. This patch sets the type dependency based on the field's type instead. This patch fixes Bug 40982.
Diffstat (limited to 'clang-tools-extra/test')
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp4
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
index 18fe5ef4e5c..2c288e0bbdd 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s bugprone-string-integer-assignment %t
+// RUN: %check_clang_tidy %s bugprone-string-integer-assignment %t -- -- -fno-delayed-template-parsing
namespace std {
template<typename T>
@@ -103,6 +103,8 @@ struct S {
static constexpr T t = 0x8000;
std::string s;
void f(char c) { s += c | static_cast<int>(t); }
+ // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: an integer is interpreted as a chara
+ // CHECK-FIXES: {{^}} void f(char c) { s += std::to_string(c | static_cast<int>(t)); }
};
template S<int>;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
index 119eff67318..8e546b44ab7 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
@@ -233,7 +233,7 @@ struct a {
template <class>
class d {
a e;
- void f() { e.b(); }
+ void f() { e.b(0); }
};
} // namespace
} // namespace PR38055
OpenPOWER on IntegriCloud