[PATCH] D14471: [AArch64] Fix a crash in driver

Renato Golin via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 02:19:03 PST 2015


rengolin added a comment.

In http://reviews.llvm.org/D14471#285492, @ahatanak wrote:

> Which two calls? Do you mean getAArch64TargetCPU and getAArch64ArchFeaturesFromMcpu?


No, the two getAArch64TargetCPU calls, but they don't even get called twice, and the value is write-only. Ignore that.

> Do you mean getAArch64TargetCPU should return "generic" when IsNative is null?


Something like that, yes. The problem here is that you're leaking out a specific fact about the cpu which should be handled by the function and not left as an exercise to the reader, in this case, the Diag message. Every other Diag or usage of that function will have to use the same convoluted pattern if they were to account for the "native" handling.

However, if you just return "native", then both getAArch64MicroArchFeaturesFromMcpu() and D.Diag() will be able to use it as any other CPU name. If getAArch64MicroArchFeaturesFromMcpu() can't cope with "native", than I think it should be changed to do so.

Makes sense?

cheers,
--renato


http://reviews.llvm.org/D14471





More information about the cfe-commits mailing list