diff options
author | Philip Reames <listmail@philipreames.com> | 2014-11-24 23:24:24 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2014-11-24 23:24:24 +0000 |
commit | 059ecbfb5875dd33c5bcea8fb99905874a2fd9f8 (patch) | |
tree | 0fcd8cdcf681358a94dd1dd261356f180f15243f /llvm/lib/IR/Function.cpp | |
parent | 238ff1ad1e766ec957bd07a36c8ce6f34ea3944a (diff) | |
download | llvm-059ecbfb5875dd33c5bcea8fb99905874a2fd9f8.zip llvm-059ecbfb5875dd33c5bcea8fb99905874a2fd9f8.tar.gz llvm-059ecbfb5875dd33c5bcea8fb99905874a2fd9f8.tar.bz2 |
Incorporate review comments from r221742
This change implements the comment and style changes Sean requested during post commit review with r221742. Sorry for the delay.
llvm-svn: 222707
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 7ed9099..fbf94b3 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -456,7 +456,15 @@ unsigned Function::lookupIntrinsicID() const { } /// Returns a stable mangling for the type specified for use in the name -/// mangling scheme used by 'any' types in intrinsic signatures. +/// mangling scheme used by 'any' types in intrinsic signatures. The mangling +/// of named types is simply their name. Manglings for unnamed types consist +/// of a prefix ('p' for pointers, 'a' for arrays, 'f_' for functions) +/// combined with the mangling of their component types. A vararg function +/// type will have a suffix of 'vararg'. Since function types can contain +/// other function types, we close a function type mangling with suffix 'f' +/// which can't be confused with it's prefix. This ensures we don't have +/// collisions between two unrelated function types. Otherwise, you might +/// parse ffXX as f(fXX) or f(fX)X. (X is a placeholder for any other type.) static std::string getMangledTypeStr(Type* Ty) { std::string Result; if (PointerType* PTyp = dyn_cast<PointerType>(Ty)) { @@ -476,7 +484,8 @@ static std::string getMangledTypeStr(Type* Ty) { Result += getMangledTypeStr(FT->getParamType(i)); if (FT->isVarArg()) Result += "vararg"; - Result += "f"; //ensure distinguishable + // Ensure nested function types are distinguishable. + Result += "f"; } else if (Ty) Result += EVT::getEVT(Ty).getEVTString(); return Result; |