notes without warnings and a question to -cc1

Hi @clang,

sometimes I'd like to issue some notes just at the start of compilation. However while there is "Diagnostic::setLastDiagnosticIgnored", there is no similiar function for other diagnostic levels. Thus for the moment I have to issue warnings instead of notes. Granted, it is a cosmetical issue only, but IMHO it can be easily fixed by introducing a "Diagnostic::setLastDiagnosticNote" or similar. I don't see any harm in introducing such a function.

The second question is related to the available options in normal and -cc1 mode. Actually I call

CompilerInvocation::CreateFromArgs(...);

to get a compiler invocation.
But CreateFromArgs uses the cc1 option table hard-coded and thus I can't pass options like "-msse2" to the compiler. This in turn forbids the handling of files which includes <xmmintrin.h> and similiar headers.
Is there a reason for using the cc1 option table there and is it possible to change it so that it is optionally possible to use the driver option table instead?

Thanks in advance and best regards
Olaf Krzikalla

sometimes I'd like to issue some notes just at the start of compilation.

Notes are always subordinate to another diagnostic. If you just want
to print to console, you should write to an output stream instead of
pretending it's a diagnostic.

CompilerInvocation::CreateFromArgs(...);

to get a compiler invocation.
But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
pass options like "-msse2" to the compiler. This in turn forbids the
handling of files which includes <xmmintrin.h> and similiar headers.
Is there a reason for using the cc1 option table there and is it
possible to change it so that it is optionally possible to use the
driver option table instead?

No. If you want to use the driver logic to figure out the arguments to pass to
CompilerInvocation, you should do that.

John.

The second question is related to the available options in normal and
-cc1 mode. Actually I call

CompilerInvocation::CreateFromArgs(...);

to get a compiler invocation.
But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
pass options like "-msse2" to the compiler. This in turn forbids the
handling of files which includes <xmmintrin.h> and similiar headers.
Is there a reason for using the cc1 option table there and is it
possible to change it so that it is optionally possible to use the
driver option table instead?

If you look into ASTUnit::LoadFromCommandLine you can find code to get a CompilerInvocation out of driver options.
This code should be factored out into its own function like a static driver::Compilation::createInvocationFromArgs.

Hi,

CompilerInvocation::CreateFromArgs(...);

to get a compiler invocation.
But CreateFromArgs uses the cc1 option table hard-coded and thus I can't
pass options like "-msse2" to the compiler. This in turn forbids the
handling of files which includes<xmmintrin.h> and similiar headers.
Is there a reason for using the cc1 option table there and is it
possible to change it so that it is optionally possible to use the
driver option table instead?

If you look into ASTUnit::LoadFromCommandLine you can find code to get a CompilerInvocation out of driver options.
This code should be factored out into its own function like a static driver::Compilation::createInvocationFromArgs.

Hmm, the code there filters out the driver options but I can't find the part where these filtered-out options are reinjected in the CompilerInvocation.
Generally speaking I don't get the point of the stripped down cc1 option list. Judging from the mails here I guess these are the options sufficiently for parsing a C file. However then something like "-msse2" (or something similiar if you want to emanzipate from gcc) is clearly missing, because some files are not parseable without that options.

Best regards
Olaf Krzikalla

Sorry, but I can't figure out how to do that. I can create a Compilation from a Driver but I have no idea how I can get from a Compilation to a CompilerInstance or CompilerInvocation. Which missing link was I unable to find?

Best regards
Olaf Krzikalla