summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-09-02 17:54:41 +0000
committerJustin Bogner <mail@justinbogner.com>2015-09-02 17:54:41 +0000
commit58e0823ee9c5da4e5ce204eb266ea47af1e8353d (patch)
treefa25a54f4e410afaffbb2e2c6df660b19474d17d /llvm/lib
parentf8c32558439c1b4bb3148911e0aa03c279585ad3 (diff)
downloadbcm5719-llvm-58e0823ee9c5da4e5ce204eb266ea47af1e8353d.tar.gz
bcm5719-llvm-58e0823ee9c5da4e5ce204eb266ea47af1e8353d.zip
IR: Invert a condition to make it more legible. NFC
Also updates the style to more modern conventions. llvm-svn: 246681
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index ae9ab8d6187..1219aac8c6a 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -2545,28 +2545,26 @@ void AssemblyWriter::printFunction(const Function *F) {
Machine.incorporateFunction(F);
// Loop over the arguments, printing them...
-
- unsigned Idx = 1;
- if (!F->isDeclaration()) {
- // If this isn't a declaration, print the argument names as well.
- for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
- I != E; ++I) {
+ if (F->isDeclaration()) {
+ // We're only interested in the type here - don't print argument names.
+ for (unsigned I = 0, E = FT->getNumParams(); I != E; ++I) {
// Insert commas as we go... the first arg doesn't get a comma
- if (I != F->arg_begin()) Out << ", ";
- printArgument(I, Attrs, Idx);
- Idx++;
+ if (I)
+ Out << ", ";
+ // Output type...
+ TypePrinter.print(FT->getParamType(I), Out);
+
+ if (Attrs.hasAttributes(I + 1))
+ Out << ' ' << Attrs.getAsString(I + 1);
}
} else {
- // Otherwise, print the types from the function type.
- for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
+ // The arguments are meaningful here, print them in detail.
+ unsigned Idx = 1;
+ for (const Argument &Arg : F->args()) {
// Insert commas as we go... the first arg doesn't get a comma
- if (i) Out << ", ";
-
- // Output type...
- TypePrinter.print(FT->getParamType(i), Out);
-
- if (Attrs.hasAttributes(i+1))
- Out << ' ' << Attrs.getAsString(i+1);
+ if (Idx != 1)
+ Out << ", ";
+ printArgument(&Arg, Attrs, Idx++);
}
}
OpenPOWER on IntegriCloud