[cfe-commits] r63776 - in /cfe/trunk: Driver/clang.cpp include/clang/Basic/LangOptions.h lib/CodeGen/CodeGenModule.cpp
Daniel Dunbar
daniel at zuster.org
Wed Feb 4 13:19:06 PST 2009
Author: ddunbar
Date: Wed Feb 4 15:19:06 2009
New Revision: 63776
URL: http://llvm.org/viewvc/llvm-project?rev=63776&view=rev
Log:
Add -femit-all-decls codegen option.
- Emits all declarations, even unused (static) ones.
- Useful when doing minimization of codegen problems (otherwise
problems localized to a static function aren't minimized well).
Modified:
cfe/trunk/Driver/clang.cpp
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=63776&r1=63775&r2=63776&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Wed Feb 4 15:19:06 2009
@@ -500,6 +500,9 @@
ObjCNonFragileABI("fobjc-nonfragile-abi",
llvm::cl::desc("enable objective-c's nonfragile abi"));
+static llvm::cl::opt<bool>
+EmitAllDecls("femit-all-decls",
+ llvm::cl::desc("Emit all declarations, even if unused"));
// FIXME: This (and all GCC -f options) really come in -f... and
// -fno-... forms, and additionally support automagic behavior when
@@ -635,6 +638,9 @@
if (ObjCNonFragileABI)
Options.ObjCNonFragileABI = 1;
+
+ if (EmitAllDecls)
+ Options.EmitAllDecls = 1;
}
static llvm::cl::opt<bool>
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=63776&r1=63775&r2=63776&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Wed Feb 4 15:19:06 2009
@@ -51,6 +51,8 @@
unsigned ThreadsafeStatics : 1; // Whether static initializers are protected
// by locks.
unsigned Blocks : 1; // block extension to C
+ unsigned EmitAllDecls : 1; // Emit all declarations, even if
+ // they are unused.
private:
unsigned GC : 2; // Objective-C Garbage Collection modes. We declare
// this enum as unsigned because MSVC insists on making enums
@@ -72,6 +74,7 @@
// FIXME: The default should be 1.
ThreadsafeStatics = 0;
Blocks = 0;
+ EmitAllDecls = 0;
}
GCMode getGCMode() const { return (GCMode) GC; }
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=63776&r1=63775&r2=63776&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Feb 4 15:19:06 2009
@@ -468,7 +468,7 @@
// If the global is a static, defer code generation until later so
// we can easily omit unused statics.
- if (isStatic) {
+ if (isStatic && !Features.EmitAllDecls) {
StaticDecls.push_back(Global);
return;
}
More information about the cfe-commits
mailing list