summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-08-01 20:57:40 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-08-01 20:57:40 +0000
commit79af384d72355dca4174e5a9ee391d38226896bc (patch)
tree1b71dfa87b6e7d60eb3dceabedff0e6dc50283e0 /clang/lib/CodeGen/CGDebugInfo.cpp
parentaad6a6a3e098b6f9b1fa748b338926be9419f50c (diff)
downloadbcm5719-llvm-79af384d72355dca4174e5a9ee391d38226896bc.tar.gz
bcm5719-llvm-79af384d72355dca4174e5a9ee391d38226896bc.zip
DebugInfo: Don't prefer declarations over definitions in -flimit-debug-info in C
Without an ODR, the -flimit-debug-info debug info size optimization of emitting declarations for fully defined types when only a declaration is needed by the TU, is incorrect. Emit the full definition whenever it's available in non-C++. llvm-svn: 187611
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 0e3b98d90e4..c903a2ce69c 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1422,7 +1422,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, bool Declaration) {
// Limited debug info should only remove struct definitions that can
// safely be replaced by a forward declaration in the source code.
if (DebugKind <= CodeGenOptions::LimitedDebugInfo && Declaration &&
- !RD->isCompleteDefinitionRequired()) {
+ !RD->isCompleteDefinitionRequired() && CGM.getLangOpts().CPlusPlus) {
// FIXME: This implementation is problematic; there are some test
// cases where we violate the above principle, such as
// test/CodeGen/debug-info-records.c .
@@ -1951,7 +1951,8 @@ llvm::DIType CGDebugInfo::getCompletedTypeOrNull(QualType Ty) {
void CGDebugInfo::completeFwdDecl(const RecordDecl &RD) {
// In limited debug info we only want to do this if the complete type was
// required.
- if (DebugKind <= CodeGenOptions::LimitedDebugInfo)
+ if (DebugKind <= CodeGenOptions::LimitedDebugInfo &&
+ CGM.getLangOpts().CPlusPlus)
return;
QualType QTy = CGM.getContext().getRecordType(&RD);
OpenPOWER on IntegriCloud