Implement -Wframe-larger-than backend diagnostic
authorAlp Toker <alp@nuanti.com>
Thu, 5 Jun 2014 22:10:59 +0000 (22:10 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 5 Jun 2014 22:10:59 +0000 (22:10 +0000)
commitfb8d02b179732b17897f1d4024583949a56b0bb5
tree9773c072cdc1e0f4a6ccfba97f3ed6cda7f2d958
parent66f676e9e53aaaba12fd9848a94915346ab76b87
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.

llvm-svn: 210293
14 files changed:
clang/include/clang/Basic/DiagnosticFrontendKinds.td
clang/include/clang/CodeGen/ModuleBuilder.h
clang/include/clang/Driver/Options.td
clang/lib/AST/ASTDiagnostic.cpp
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/ModuleBuilder.cpp
clang/lib/Driver/Tools.cpp
clang/test/Frontend/backend-diagnostic.c
clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp [new file with mode: 0644]
clang/test/Misc/backend-stack-frame-diagnostics.cpp [new file with mode: 0644]