/// Returns the type of the APSInt used to store values of the given QualType.
APSIntType getAPSIntType(QualType T) const {
+ // For the purposes of the analysis and constraints, we treat atomics
+ // as their underlying types.
+ if (const AtomicType *AT = T->getAs<AtomicType>()) {
+ T = AT->getValueType();
+ }
+
assert(T->isIntegralOrEnumerationType() || Loc::isLocType(T));
return APSIntType(Ctx.getIntWidth(T),
!T->isSignedIntegerOrEnumerationType());
clang_analyzer_eval(s->refCount == 3); // expected-warning {{UNKNOWN}}
clang_analyzer_eval(expected == 2); // expected-warning {{UNKNOWN}}
}
+
+// PR49422
+void test_atomic_compare(int input) {
+ _Atomic(int) x = input;
+ if (x > 0) {
+ // no crash
+ }
+}