summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CWriter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-03 04:31:54 +0000
committerChris Lattner <sabre@nondot.org>2003-11-03 04:31:54 +0000
commit7be3ab2fb7fd055a3b830b6d53e0851854417514 (patch)
tree107c7a8108ba3863dba5c9083abe305220213cf9 /llvm/lib/CWriter
parent1693079e92bf205253a322961dd191a8d17d8a97 (diff)
downloadbcm5719-llvm-7be3ab2fb7fd055a3b830b6d53e0851854417514.tar.gz
bcm5719-llvm-7be3ab2fb7fd055a3b830b6d53e0851854417514.zip
This simplifies the CWriter code, makes the generated code easier to read,
and makes the output work with the intel compiler. Overall, a win. llvm-svn: 9671
Diffstat (limited to 'llvm/lib/CWriter')
-rw-r--r--llvm/lib/CWriter/Writer.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp
index d778d1e946f..e32987cbd2e 100644
--- a/llvm/lib/CWriter/Writer.cpp
+++ b/llvm/lib/CWriter/Writer.cpp
@@ -163,11 +163,6 @@ namespace {
};
}
-// A pointer type should not use parens around *'s alone, e.g., (**)
-inline bool ptrTypeNameNeedsParens(const std::string &NameSoFar) {
- return NameSoFar.find_last_not_of('*') != std::string::npos;
-}
-
// Pass the Type* and the variable name and this prints out the variable
// declaration.
//
@@ -240,12 +235,8 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
const PointerType *PTy = cast<PointerType>(Ty);
std::string ptrName = "*" + NameSoFar;
- // Do not need parens around "* NameSoFar" if NameSoFar consists only
- // of zero or more '*' chars *and* this is not an unnamed pointer type
- // such as the result type in a cast statement. Otherwise, enclose in ( ).
- if (ptrTypeNameNeedsParens(NameSoFar) ||
- PTy->getElementType()->getPrimitiveID() == Type::ArrayTyID)
- ptrName = "(" + ptrName + ")"; //
+ if (isa<ArrayType>(PTy->getElementType()))
+ ptrName = "(" + ptrName + ")";
return printType(Out, PTy->getElementType(), ptrName);
}
OpenPOWER on IntegriCloud