TI-ARM-CLANG Compiler optimization setting

Hi experts,

I am using the TI ARM CALNG complier for code generating. I have known that set the optimization level through project->properties->arm complier->...

However, I am confused that is there a way meet the below requirement:

Within a file's code, set a specific small section of code not optimized. For example, the project is set as optimization level - O2, but in the specific file of the project, I need set partial code not optimized (because it might cause the code logic wrong - customer find it wrong with O-2 optimization, but work with O-0).

The way I think, is to create a new file, migrate the code that need prohibit optimization, package it into a function, and then set the file not to be optimized. But this will be relatively complex.

Is there any Attributes or other command can help? I went through the user's guide, and seems to be nothing. 

B.R.

Sal