MSVC pragma function tells the compiler to generate calls to functions in the pragma function list, instead of using the builtin. Needs https://reviews.llvm.org/D124701
https://docs.microsoft.com/en-us/cpp/preprocessor/function-c-cpp?view=msvc-170
|  Differential  D124702  
[MSVC] Add support for pragma function Authored by steplong on Apr 29 2022, 2:55 PM. 
Details MSVC pragma function tells the compiler to generate calls to functions in the pragma function list, instead of using the builtin. Needs https://reviews.llvm.org/D124701 https://docs.microsoft.com/en-us/cpp/preprocessor/function-c-cpp?view=msvc-170 
Diff Detail 
 Event TimelineComment Actions From the MS docs: 
 Should we try to handle the interaction between pragma intrinsic and pragma function, i.e. that the former "undoes" the latter? And should we error/warn if the pragma occurs not in namespace scope? 
 Comment Actions Oh I wasn't sure how to check if the function pragma was outside of a function. Yup, we can try to handle pragma intrinsic Comment Actions 
 In the ActOn.. methods I think you can check what the CurContext is. 
 
 Comment Actions It needs tests for the warnings about badly formed pragmas, and for pragmas outside file/namespace scope. 
 Comment Actions Appreciate the comments. I have a couple of questions: Is the tests for badly formed pragmas, clang/test/Preprocessor/pragma_microsoft.c? 
 Comment Actions Changed it to use SmallSetVector instead of SmallVector. Had to use an temporary SmallVector in AddRangeBasedNoBuiltin() because I'm not sure how to get a pointer to StringRef. getArrayRef().copy().data() needs an Allocator. Also, I can't figure out why the test pragma-ms-function-intrinsic.c is failing from the pragma not being in file context. The pragmas are not inside a function. Will add Sema and parsing tests in the next update to this patch. 
 
 Comment Actions 
 
 
 
 
 Comment Actions 
 struct S {
  int a;
#pragma function(memset)
};
 Comment Actions 
 Comment Actions Thanks for all the hard work on this, LGTM! Can you please add a release note to clang/docs/ReleaseNotes.rst for the new functionality (probably best under the New Pragmas in Clang heading) when you land it? 
 
 
 Comment Actions 
 Comment Actions LGTM, thanks for all the work here! 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||