diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-12-14 19:34:32 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-12-14 19:34:32 +0000 |
| commit | a850594e8be4f3a3cb7c4d404b8434dfb3844ec8 (patch) | |
| tree | 1d1182ac2a41e0ef5e4b5544d15f21c9b8d554cd /lib/Target/CppBackend/CPPBackend.cpp | |
| parent | 5dbe26aa8326068823cb9481972426dca151c3cc (diff) | |
| download | external_llvm-a850594e8be4f3a3cb7c4d404b8434dfb3844ec8.zip external_llvm-a850594e8be4f3a3cb7c4d404b8434dfb3844ec8.tar.gz external_llvm-a850594e8be4f3a3cb7c4d404b8434dfb3844ec8.tar.bz2 | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
| -rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 4bae6c7..a872fbd 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -976,21 +976,20 @@ namespace { nl(Out); printType(GV->getType()); if (GV->hasInitializer()) { - Constant* Init = GV->getInitializer(); + Constant *Init = GV->getInitializer(); printType(Init->getType()); - if (Function* F = dyn_cast<Function>(Init)) { + if (Function *F = dyn_cast<Function>(Init)) { nl(Out)<< "/ Function Declarations"; nl(Out); printFunctionHead(F); } else if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) { nl(Out) << "// Global Variable Declarations"; nl(Out); 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); printVariableBody(gv); + } else { + nl(Out) << "// Constant Definitions"; nl(Out); + printConstant(Init); } } } |
