[cfe-commits] r89457 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Daniel Dunbar daniel at zuster.org
Sat Nov 21 21:02:53 PST 2009


Test case please.

 - Daniel

On Fri, Nov 20, 2009 at 6:50 AM, David Chisnall <csdavec at swan.ac.uk> wrote:
> Author: theraven
> Date: Fri Nov 20 08:50:59 2009
> New Revision: 89457
>
> URL: http://llvm.org/viewvc/llvm-project?rev=89457&view=rev
> Log:
> Fixed crash when using undefined protocols (GNU runtime).
>
>
> Modified:
>    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=89457&r1=89456&r2=89457&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Fri Nov 20 08:50:59 2009
> @@ -747,9 +747,14 @@
>   std::vector<llvm::Constant*> Elements;
>   for (const std::string *iter = Protocols.begin(), *endIter = Protocols.end();
>       iter != endIter ; iter++) {
> -    llvm::Constant *protocol = ExistingProtocols[*iter];
> -    if (!protocol)
> +    llvm::Constant *protocol = 0;
> +    llvm::StringMap<llvm::Constant*>::iterator value =
> +      ExistingProtocols.find(*iter);
> +    if (value == ExistingProtocols.end()) {
>       protocol = GenerateEmptyProtocol(*iter);
> +    } else {
> +      protocol = value->getValue();
> +    }
>     llvm::Constant *Ptr = llvm::ConstantExpr::getBitCast(protocol,
>                                                            PtrToInt8Ty);
>     Elements.push_back(Ptr);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list