[cfe-commits] [Patch][review-request]Fix for 'using namespace' within function body in static analyzer

Ted Kremenek kremenek at apple.com
Mon Feb 14 09:04:01 PST 2011


Applied in r125491.  Thanks!

On Feb 14, 2011, at 4:45 AM, Jim Goodnow II wrote:

> The following code, when compiled with 'clang -cc1 -analyze -analyzer-check-objc-mem -cfg-dump' will generate a 'Subtype of ScopeDecl not handled error', I'm not sure where a test case should go for this?
> 
> namespace fum {
>  int i = 3;
> };
> 
> void foo() {
>  using namespace fum;
> 
>  int x = i;
> }
> 
> Patch:
> 
> Index: include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
> ===================================================================
> --- include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h	(revision 125488)
> +++ include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h	(working copy)
> @@ -66,6 +66,7 @@
>         DISPATCH_CASE(Record)    // FIXME: Refine.  VisitStructDecl?
>         DISPATCH_CASE(CXXRecord)
>         DISPATCH_CASE(Enum)
> +        DISPATCH_CASE(UsingDirective)
>       default:
>         assert(false && "Subtype of ScopedDecl not handled.");
>     }
> @@ -85,6 +86,7 @@
>   DEFAULT_DISPATCH(ObjCMethod)
>   DEFAULT_DISPATCH(ObjCProtocol)
>   DEFAULT_DISPATCH(ObjCCategory)
> +  DEFAULT_DISPATCH(UsingDirective)
> 
>   void VisitCXXRecordDecl(CXXRecordDecl *D) {
>     static_cast<ImplClass*>(this)->VisitRecordDecl(D);<using.patch>





More information about the cfe-commits mailing list