[PATCH] add __attribute__ no_uninitialized_checks. Map no_uninitialized_checks/no_thread_safety_analysis to LLVM function attributes.

Dmitri Gribenko gribozavr at gmail.com
Mon Feb 11 07:04:05 PST 2013



================
Comment at: lib/Sema/SemaDeclAttr.cpp:655-656
@@ +654,4 @@
+  if (!isa<FunctionDecl>(D) && !isa<FunctionTemplateDecl>(D)) {
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+      << Attr.getName() << ExpectedFunctionOrMethod;
+    return;
----------------
Kostya Serebryany wrote:
> Dmitri Gribenko wrote:
> > Can we promote this to an error?  There's no existing code that (mis)uses this attribute, so there should be no compatibility concerns.
> > 
> > Please also add tests for this warning or error, and for checkAttributeNumArgs() condition above.
> I copy-pasted the code from the pre-existing code for no_thread_safety_analysis
> and I did not fund such tests for that one. 
> I guess we need tests for all 3 (+ no_address_safety_analysis). 
> Where is the best place for them? Do you know similar existing tests? 
> 
> Yes, I guess we can make it an error. Will do the change tomorrow. 
There are tests for no_address_safety_analysis in test/SemaCXX/warn-thread-safety-parsing.cpp (lines 93-121).

For this attribute, tests should probably go into test/SemaCXX/attr-no-uninitialized-checks.cpp (because we don't do static analysis, it is attr- instead of warn-).


http://llvm-reviews.chandlerc.com/D390



More information about the cfe-commits mailing list