[llvm] r183830 - Fix 'gcc -flto' builds for unittest binaries (undefined reference to

Nick Lewycky nicholas at mxc.ca
Wed Jun 12 11:24:46 PDT 2013


Patrik Hagglund wrote:
> Author: patha
> Date: Wed Jun 12 09:15:21 2013
> New Revision: 183830
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183830&view=rev
> Log:
> Fix 'gcc -flto' builds for unittest binaries (undefined reference to
> `typeinfo for llvm::cl::GenericOptionValue').
>
> Remove an "anchor" method for an abstract class. (This does not
> increase the number of vtables.)
>
> Modified:
>      llvm/trunk/include/llvm/Support/CommandLine.h
>      llvm/trunk/lib/Support/CommandLine.cpp
>
> Modified: llvm/trunk/include/llvm/Support/CommandLine.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=183830&r1=183829&r2=183830&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/CommandLine.h (original)
> +++ llvm/trunk/include/llvm/Support/CommandLine.h Wed Jun 12 09:15:21 2013
> @@ -350,8 +350,6 @@ struct cat {
>   struct GenericOptionValue {
>     virtual ~GenericOptionValue() {}

Any reason this (the destructor) isn't declared here ...

>     virtual bool compare(const GenericOptionValue&V) const = 0;
> -private:
> -  virtual void anchor();
>   };
>
>   template<class DataType>  struct OptionValue;
>
> Modified: llvm/trunk/lib/Support/CommandLine.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=183830&r1=183829&r2=183830&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/CommandLine.cpp (original)
> +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Jun 12 09:15:21 2013
> @@ -59,7 +59,6 @@ TEMPLATE_INSTANTIATION(class opt<char>);
>   TEMPLATE_INSTANTIATION(class opt<bool>);
>   } } // end namespace llvm::cl
>
> -void GenericOptionValue::anchor() {}

... and defined here?

Giving the key method a definition in a single TU instead of in all TUs 
could cut down on .o size -- though this is a class with little/no 
associated code, it would still shrink debug .o sizes?

Nick

>   void OptionValue<boolOrDefault>::anchor() {}
>   void OptionValue<std::string>::anchor() {}
>   void Option::anchor() {}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list