English 中文(简体)
Clang: Don t Superior a given file
原标题:Clang: Don t optimize a given file

在与地兰进行汇编时,我可以添加<条码>optnone。

[[clang::optnone]]
void foo() {
    // no optimizations applied in here
    ...
}

void bar() {
    // while other functions are still optimized
}

在与亚洲开发银行脱钩时,这确实是有益的。 关于规模太大、无法完全以减速方式编纂的方案(llvm),我可以编篡将CMake编成RelWithDebInfo,增加一些感兴趣的职能,然后在这些地方进行持续的减小,而不必绕过和打上线的价值观。

Is there any equivalent way to compile all functions in a given file in debug mode, without manually adding the attribute to every function?

Cheers

最佳回答

你有几种选择:

  1. Compile your source files individually to object files (this is automatically done with most build setups); then for your particular object file, set custom optimization settings. For example:
cc -O3 file1.c -c -o file1.o
cc -O0 -g file2.c -c -o file2.o

只优化<代码>file1.c,但不能优化file2.c。 这一工作面向任何汇编者。

  1. Use a range-based optimization pragma, a Clang extension. Write #pragma clang optimize off to disable optimizations from that point onward, and #pragma clang optimize on to reenable them. For example, simply putting #pragma clang optimize off at the top of the file will disable optimizations for the entire file.
问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签