1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

fix an obvious bug found by clang++ and collapse a redundant if.

Here's the diagnostic from clang:

/Volumes/Data/dgregor/Projects/llvm/lib/Target/CppBackend/CPPBackend.cpp:989:23: warning: 'gv' is always NULL in this context
        printConstant(gv);
                      ^
1 diagnostic generated.

llvm-svn: 91318
This commit is contained in:
Chris Lattner 2009-12-14 19:34:32 +00:00
parent 8e0956f734
commit 81c6d73285

View File

@ -976,21 +976,20 @@ namespace {
nl(Out); nl(Out);
printType(GV->getType()); printType(GV->getType());
if (GV->hasInitializer()) { if (GV->hasInitializer()) {
Constant* Init = GV->getInitializer(); Constant *Init = GV->getInitializer();
printType(Init->getType()); printType(Init->getType());
if (Function* F = dyn_cast<Function>(Init)) { if (Function *F = dyn_cast<Function>(Init)) {
nl(Out)<< "/ Function Declarations"; nl(Out); nl(Out)<< "/ Function Declarations"; nl(Out);
printFunctionHead(F); printFunctionHead(F);
} else if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) { } else if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) {
nl(Out) << "// Global Variable Declarations"; nl(Out); nl(Out) << "// Global Variable Declarations"; nl(Out);
printVariableHead(gv); printVariableHead(gv);
} else {
nl(Out) << "// Constant Definitions"; nl(Out);
printConstant(gv);
}
if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) {
nl(Out) << "// Global Variable Definitions"; nl(Out); nl(Out) << "// Global Variable Definitions"; nl(Out);
printVariableBody(gv); printVariableBody(gv);
} else {
nl(Out) << "// Constant Definitions"; nl(Out);
printConstant(Init);
} }
} }
} }