Add support for mangling guard variables.

llvm-svn: 68969
This commit is contained in:
Anders Carlsson 2009-04-13 18:02:10 +00:00
parent 42959b2660
commit 0c08f6fdde
2 changed files with 23 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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