diff options
| author | George Burgess IV <george.burgess.iv@gmail.com> | 2015-12-02 21:58:08 +0000 |
|---|---|---|
| committer | George Burgess IV <george.burgess.iv@gmail.com> | 2015-12-02 21:58:08 +0000 |
| commit | 3e3bb95b6951c313dd5dd1c099184c309a3952e2 (patch) | |
| tree | 601f182e5509276b9319182864eac0e27a888b68 /clang/lib/AST/MicrosoftMangle.cpp | |
| parent | ba904d4ecf66528be5dadd60665d5a979ce6b1a4 (diff) | |
| download | bcm5719-llvm-3e3bb95b6951c313dd5dd1c099184c309a3952e2.tar.gz bcm5719-llvm-3e3bb95b6951c313dd5dd1c099184c309a3952e2.zip | |
Add the `pass_object_size` attribute to clang.
`pass_object_size` is our way of enabling `__builtin_object_size` to
produce high quality results without requiring inlining to happen
everywhere.
A link to the design doc for this attribute is available at the
Differential review link below.
Differential Revision: http://reviews.llvm.org/D13263
llvm-svn: 254554
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
| -rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index c1c2d2d1a45..3651673ffd2 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -1841,8 +1841,20 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T, Out << 'X'; } else { // Happens for function pointer type arguments for example. - for (const QualType &Arg : Proto->param_types()) - mangleArgumentType(Arg, Range); + for (unsigned I = 0, E = Proto->getNumParams(); I != E; ++I) { + mangleArgumentType(Proto->getParamType(I), Range); + // Mangle each pass_object_size parameter as if it's a paramater of enum + // type passed directly after the parameter with the pass_object_size + // attribute. The aforementioned enum's name is __pass_object_size, and we + // pretend it resides in a top-level namespace called __clang. + // + // FIXME: Is there a defined extension notation for the MS ABI, or is it + // necessary to just cross our fingers and hope this type+namespace + // combination doesn't conflict with anything? + if (D) + if (auto *P = D->getParamDecl(I)->getAttr<PassObjectSizeAttr>()) + Out << "W4__pass_object_size" << P->getType() << "@__clang@@"; + } // <builtin-type> ::= Z # ellipsis if (Proto->isVariadic()) Out << 'Z'; |

