-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Add setting to override ClangImporter driver options #8682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Add setting to override ClangImporter driver options #8682
Conversation
@swift-ci test |
// the first argument. | ||
raw_args.push_back("clang"); | ||
for (const std::string &arg : args) | ||
raw_args.push_back(arg.data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this very scary because we don't know if args contents is nullterminated and it's easy to break this contract in the future.
Could we just make this a std::vector<std::string>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the type of args
is std::vector<std::string>
.
If you are referring to raw_args
and its type llvm::SmallVector<const char *, 64>
, note that it's used because that's the signature of clang::driver::applyOverrideOptions
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see!
Is the null-terminator guaranteed, or should this be arg.c_str()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's guaranteed to be null terminated:
The returned array is null-terminated, that is,
data()
andc_str()
perform the same function. (since C++11)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually very useful, couple of nits inside.
@swift-ci test |
@swift-ci test |
Introduce the
target.swift-clang-override-options
setting, which provides the debugger the same functionality asCCC_OVERRIDE_OPTIONS
. This is useful as an additional means to workaround issues that can arise with ClangImporter options. This is more powerful than the existingtarget.swift-extra-clang-flags
setting, which only allows flags to be added, not deleted or rewritten.Depends on llvm#85425