This is an archive of the discontinued LLVM Phabricator instance.

[clang-cl] Ignore #pragma managed / #pragma unmanaged
ClosedPublic

Authored by saudi on Dec 8 2022, 7:49 AM.

Details

Summary

Those 2 pragmas are ignored by MSVC when not compiling with /CLR, which clang doesn't support.
Ignore them in clang -fms-extensions, to avoid -Wunknown-pragma warnings.

See https://learn.microsoft.com/en-us/cpp/preprocessor/managed-unmanaged?view=msvc-170

Diff Detail

Event Timeline

saudi created this revision.Dec 8 2022, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 7:49 AM
saudi requested review of this revision.Dec 8 2022, 7:49 AM
thieta added inline comments.Dec 8 2022, 8:18 AM
clang/lib/Lex/Pragma.cpp
1960

I don't see the other comments in this file having "\# I think you can drop that. Also two / for the comments, not three.

thakis accepted this revision.Dec 9 2022, 12:48 PM

LG (except for thieta's nit.)

Do you have commit permissions, or do you need someone to land this for you? If the latter, which name and email should we use for landing it?

This revision is now accepted and ready to land.Dec 9 2022, 12:48 PM
saudi added a comment.Dec 9 2022, 1:08 PM

LG (except for thieta's nit.)

Do you have commit permissions, or do you need someone to land this for you? If the latter, which name and email should we use for landing it?

I have commit permissions, I can land it myself, thanks!

@thieta The comments formatting I used was copied from similar classes in that same Pragma.cppfile; could you re-check?
e.g. https://github.com/llvm-mirror/clang/blob/master/lib/Lex/Pragma.cpp#L1825

thieta added a comment.Dec 9 2022, 1:25 PM

It still looks odd to me, but since the rest of the file has comments like that I am fine with it. But I think we should figure out if they are like that because some tool is parsing them or if it's just legacy.

This revision was landed with ongoing or failed builds.Dec 12 2022, 7:01 AM
This revision was automatically updated to reflect the committed changes.