[PATCH] D12482: Analyzer: Teach analyzer how to handle TypeTraitExpr

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 18:11:04 PDT 2015


dcoughlin added a comment.

You should add a test covering the added logic in SValBuilder. For example:

  clang_analyzer_eval(__is_trivial(NonTrivial)); // expected-warning {{FALSE}}

And while we're at it, it would be good to add a test for UnaryExprOrTypeTraitExpr as well:

  clang_analyzer_eval(__alignof(NonTrivial) > 0); // expected-warning {{TRUE}}

Other than that, looks good to me. Thanks Ismail!


================
Comment at: lib/StaticAnalyzer/Core/SValBuilder.cpp:264
@@ +263,3 @@
+    const TypeTraitExpr *TE = cast<TypeTraitExpr>(E);
+    return makeTruthVal(TE->getValue(), TE->getType());;
+  }
----------------
Extra semi-colon here.


http://reviews.llvm.org/D12482





More information about the cfe-commits mailing list