[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Globals.cpp Module.cpp Verifier.cpp

Chris Lattner clattner at apple.com
Wed Apr 25 13:15:34 PDT 2007


On Apr 25, 2007, at 7:28 AM, Anton Korobeynikov wrote:

> +void GlobalAlias::setAliasee(const GlobalValue *GV)
> +{
> +  // FIXME: Some checks?
> +  Aliasee = GV;
> +}
> +

This should assert that GV type matches the alias type.

> @@ -277,7 +282,9 @@
>    Assert1(!GV.isDeclaration() ||
>            GV.hasExternalLinkage() ||
>            GV.hasDLLImportLinkage() ||
> -          GV.hasExternalWeakLinkage(),
> +          GV.hasExternalWeakLinkage() ||
> +          (isa<GlobalAlias>(GV) &&
> +           (GV.hasInternalLinkage() || GV.hasWeakLinkage())),
>    "Global is external, but doesn't have external or dllimport or  
> weak linkage!",
>            &GV);

Hopefully we can eliminate internal aliases...

>
> @@ -303,6 +310,16 @@
>    visitGlobalValue(GV);
>  }
>
> +void Verifier::visitGlobalAlias(GlobalAlias &GA) {
> +  Assert1(!GA.getName().empty(),
> +          "Alias name cannot be empty!", &GA);
> +  Assert1(GA.hasExternalLinkage() || GA.hasInternalLinkage() ||
> +          GA.hasWeakLinkage(),
> +          "Alias should have external or external weak linkage!",  
> &GA);

This should check that the alias and aliasee have the same type.

-Chris





More information about the llvm-commits mailing list