Can you explain why this works at all?  Why aren't the counters emitted as
linkonce_odr globals?


On Tue, May 27, 2014 at 4:39 PM, Alex L <[email protected]> wrote:

> This is needed to ensure that the profile counters are emitted
> for all functions and methods.
>
>
> -------------- next part --------------
> Index: lib/CodeGen/CodeGenModule.cpp
> ===================================================================
>
> --- lib/CodeGen/CodeGenModule.cpp     (revision 209698)
> +++ lib/CodeGen/CodeGenModule.cpp     (working copy)
> @@ -1073,6 +1073,8 @@
>    if (LangOpts.EmitAllDecls)
>      return false;
>
> +  if(CodeGenOpts.ProfileInstrGenerate && isa<FunctionDecl>(Global))
>
> +    return false;
>    return !getContext().DeclMustBeEmitted(Global);
>  }
>
> @@ -3028,6 +3030,16 @@
>      break;
>
>    // C++ Decls
> +  case Decl::CXXRecord: {
> +    if(!CodeGenOpts.ProfileInstrGenerate)
>
> +      break;
> +    CXXRecordDecl *Record = cast<CXXRecordDecl>(D);
> +    for(CXXRecordDecl::method_iterator I = Record->method_begin(); I != 
> Record->method_end(); ++I) {
> +      if(I->hasBody())
> +        EmitTopLevelDecl(*I);
>
> +    }
> +    break;
> +  }
>    case Decl::Namespace:
>      EmitNamespace(cast<NamespaceDecl>(D));
>      break;
>
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to