diff options
Diffstat (limited to 'clang/include/clang')
-rw-r--r-- | clang/include/clang/AST/ASTContext.h | 11 | ||||
-rw-r--r-- | clang/include/clang/AST/MangleNumberingContext.h | 19 | ||||
-rw-r--r-- | clang/include/clang/Sema/Sema.h | 2 |
3 files changed, 23 insertions, 9 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 7c2cea25cce..f0b0e41bd0f 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -344,8 +344,9 @@ class ASTContext : public RefCountedBase<ASTContext> { llvm::DenseMap<const DeclContext *, MangleNumberingContext> MangleNumberingContexts; - llvm::DenseMap<const DeclContext *, unsigned> UnnamedMangleContexts; - llvm::DenseMap<const TagDecl *, unsigned> UnnamedMangleNumbers; + /// \brief Side-table of mangling numbers for declarations which rarely + /// need them (like static local vars). + llvm::DenseMap<const NamedDecl *, unsigned> MangleNumbers; /// \brief Mapping that stores parameterIndex values for ParmVarDecls when /// that value exceeds the bitfield size of ParmVarDeclBits.ParameterIndex. @@ -2086,12 +2087,12 @@ public: /// it is not used. bool DeclMustBeEmitted(const Decl *D); - void addUnnamedTag(const TagDecl *Tag); - int getUnnamedTagManglingNumber(const TagDecl *Tag) const; + void setManglingNumber(const NamedDecl *ND, unsigned Number); + unsigned getManglingNumber(const NamedDecl *ND) const; /// \brief Retrieve the context for computing mangling numbers in the given /// DeclContext. - MangleNumberingContext &getManglingNumberContext(DeclContext *DC); + MangleNumberingContext &getManglingNumberContext(const DeclContext *DC); /// \brief Used by ParmVarDecl to store on the side the /// index of the parameter when it exceeds the size of the normal bitfield. diff --git a/clang/include/clang/AST/MangleNumberingContext.h b/clang/include/clang/AST/MangleNumberingContext.h index 35c2abd9d84..4f81e0c5548 100644 --- a/clang/include/clang/AST/MangleNumberingContext.h +++ b/clang/include/clang/AST/MangleNumberingContext.h @@ -23,22 +23,35 @@ namespace clang { class BlockDecl; class CXXMethodDecl; +class IdentifierInfo; +class TagDecl; class Type; +class VarDecl; /// \brief Keeps track of the mangled names of lambda expressions and block /// literals within a particular context. class MangleNumberingContext : public RefCountedBase<MangleNumberingContext> { llvm::DenseMap<const Type *, unsigned> ManglingNumbers; - + llvm::DenseMap<IdentifierInfo*, unsigned> VarManglingNumbers; + llvm::DenseMap<IdentifierInfo*, unsigned> TagManglingNumbers; + public: /// \brief Retrieve the mangling number of a new lambda expression with the /// given call operator within this context. - unsigned getManglingNumber(CXXMethodDecl *CallOperator); + unsigned getManglingNumber(const CXXMethodDecl *CallOperator); /// \brief Retrieve the mangling number of a new block literal within this /// context. - unsigned getManglingNumber(BlockDecl *BD); + unsigned getManglingNumber(const BlockDecl *BD); + + /// \brief Retrieve the mangling number of a static local variable within + /// this context. + unsigned getManglingNumber(const VarDecl *VD); + + /// \brief Retrieve the mangling number of a static local variable within + /// this context. + unsigned getManglingNumber(const TagDecl *TD); }; } // end namespace clang diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 1d780def42d..6345989f160 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -716,7 +716,7 @@ public: /// \param[out] ManglingContextDecl - Returns the ManglingContextDecl /// associated with the context, if relevant. MangleNumberingContext *getCurrentMangleNumberContext( - DeclContext *DC, + const DeclContext *DC, Decl *&ManglingContextDecl); |