diff options
| author | Alp Toker <alp@nuanti.com> | 2014-06-05 22:10:59 +0000 |
|---|---|---|
| committer | Alp Toker <alp@nuanti.com> | 2014-06-05 22:10:59 +0000 |
| commit | c1ba5d5c4623443fe4cd25ef70d0af149f97b16c (patch) | |
| tree | 0f44341be007bdce69a90c267d7a3be696f11de8 /lib/CodeGen/ModuleBuilder.cpp | |
| parent | 9266985b619ddd85632a0616af41f0e917646c24 (diff) | |
| download | clang-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/ModuleBuilder.cpp')
| -rw-r--r-- | lib/CodeGen/ModuleBuilder.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index 78cb82dc55..e5bdae93fe 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/lib/CodeGen/ModuleBuilder.cpp @@ -49,6 +49,21 @@ namespace { return M.get(); } + const Decl *GetDeclForMangledName(StringRef MangledName) override { + GlobalDecl Result; + if (!Builder->lookupRepresentativeDecl(MangledName, Result)) + return nullptr; + const Decl *D = Result.getCanonicalDecl().getDecl(); + if (auto FD = dyn_cast<FunctionDecl>(D)) { + if (FD->hasBody(FD)) + return FD; + } else if (auto TD = dyn_cast<TagDecl>(D)) { + if (auto Def = TD->getDefinition()) + return Def; + } + return D; + } + llvm::Module *ReleaseModule() override { return M.release(); } void Initialize(ASTContext &Context) override { |
