diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-04-13 18:02:10 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-04-13 18:02:10 +0000 |
| commit | 0c08f6fddec505336474209e911866d919a6a3a1 (patch) | |
| tree | 31921501ab7090d378867a7064fd91c1bf9f815d | |
| parent | 42959b266019040c9fa20fa5a4877f60fea01d71 (diff) | |
| download | bcm5719-llvm-0c08f6fddec505336474209e911866d919a6a3a1.tar.gz bcm5719-llvm-0c08f6fddec505336474209e911866d919a6a3a1.zip | |
Add support for mangling guard variables.
llvm-svn: 68969
| -rw-r--r-- | clang/lib/CodeGen/Mangle.cpp | 19 | ||||
| -rw-r--r-- | clang/lib/CodeGen/Mangle.h | 5 |
2 files changed, 23 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp index dac9a7c57a9..049353faae9 100644 --- a/clang/lib/CodeGen/Mangle.cpp +++ b/clang/lib/CodeGen/Mangle.cpp @@ -34,6 +34,7 @@ namespace { : Context(C), Out(os) { } bool mangle(const NamedDecl *D); + void mangleGuardVariable(const VarDecl *D); private: bool mangleFunctionDecl(const FunctionDecl *FD); @@ -124,6 +125,15 @@ bool CXXNameMangler::mangle(const NamedDecl *D) { return false; } +void CXXNameMangler::mangleGuardVariable(const VarDecl *D) +{ + // <special-name> ::= GV <object name> # Guard variable for one-time + // # initialization + + Out << "_ZGV"; + mangleName(D); +} + void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD) { // <encoding> ::= <function name> <bare-function-type> mangleName(FD); @@ -586,5 +596,14 @@ namespace clang { os.flush(); return true; } + + /// mangleGuardVariable - Mangles the m + void mangleGuardVariable(const VarDecl *D, ASTContext &Context, + llvm::raw_ostream &os) { + CXXNameMangler Mangler(Context, os); + Mangler.mangleGuardVariable(D); + + os.flush(); + } } diff --git a/clang/lib/CodeGen/Mangle.h b/clang/lib/CodeGen/Mangle.h index 627c16a08ef..b3f88b0d687 100644 --- a/clang/lib/CodeGen/Mangle.h +++ b/clang/lib/CodeGen/Mangle.h @@ -25,9 +25,12 @@ namespace llvm { namespace clang { class ASTContext; class NamedDecl; - + class VarDecl; + bool mangleName(const NamedDecl *D, ASTContext &Context, llvm::raw_ostream &os); + void mangleGuardVariable(const VarDecl *D, ASTContext &Context, + llvm::raw_ostream &os); } #endif |

