summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-05 22:10:59 +0000
committerAlp Toker <alp@nuanti.com>2014-06-05 22:10:59 +0000
commitc1ba5d5c4623443fe4cd25ef70d0af149f97b16c (patch)
tree0f44341be007bdce69a90c267d7a3be696f11de8 /lib/CodeGen/CodeGenModule.h
parent9266985b619ddd85632a0616af41f0e917646c24 (diff)
downloadclang-c1ba5d5c4623443fe4cd25ef70d0af149f97b16c.tar.gz
clang-c1ba5d5c4623443fe4cd25ef70d0af149f97b16c.tar.bz2
clang-c1ba5d5c4623443fe4cd25ef70d0af149f97b16c.tar.xz
Implement -Wframe-larger-than backend diagnostic
Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning. This is the first GCC-compatible backend diagnostic built around LLVM's reporting feature. This commit adds infrastructure to perform reverse lookup from mangled names emitted after LLVM IR generation. We use that to resolve precise locations and originating AST functions, lambdas or block declarations to produce seamless codegen-guided diagnostics. An associated change, StringMap now maintains unique mangled name strings instead of allocating copies. This is a net memory saving in C++ and a small hit for C where we no longer reuse IdentifierInfo storage, pending further optimisation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210293 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r--lib/CodeGen/CodeGenModule.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index f157d20e6c..6cb4fc17c5 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -287,7 +287,7 @@ class CodeGenModule : public CodeGenTypeCache {
/// for emission and therefore should only be output if they are actually
/// used. If a decl is in this, then it is known to have not been referenced
/// yet.
- llvm::StringMap<GlobalDecl> DeferredDecls;
+ std::map<StringRef, GlobalDecl> DeferredDecls;
/// This is a list of deferred decls which we have seen that *are* actually
/// referenced. These get code generated when the module is done.
@@ -327,8 +327,8 @@ class CodeGenModule : public CodeGenTypeCache {
/// A map of canonical GlobalDecls to their mangled names.
llvm::DenseMap<GlobalDecl, StringRef> MangledDeclNames;
- llvm::BumpPtrAllocator MangledNamesAllocator;
-
+ llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
+
/// Global annotations.
std::vector<llvm::Constant*> Annotations;
@@ -522,6 +522,9 @@ public:
StaticLocalDeclGuardMap[D] = C;
}
+ bool lookupRepresentativeDecl(StringRef MangledName,
+ GlobalDecl &Result) const;
+
llvm::Constant *getAtomicSetterHelperFnMap(QualType Ty) {
return AtomicSetterHelperFnMap[Ty];
}
@@ -922,7 +925,7 @@ public:
bool AttrOnCallSite);
StringRef getMangledName(GlobalDecl GD);
- std::string getBlockMangledName(GlobalDecl GD, const BlockDecl *BD);
+ StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD);
void EmitTentativeDefinition(const VarDecl *D);