[llvm-commits] [PATCH] Add declaration of hash_value in APFloat / APInt (required for xlC on AIX)
Kai
kai at redstar.de
Sat Oct 27 12:29:02 PDT 2012
Hi!
I am trying to compile LLVM with the IBM xlC compiler on AIX 7.1 The
first issue I encounter is that the function hash_value() is declared as
a friend of APFloat and APInt, but no matching declaration is provided.
This results in the error message:
"../llvm-git/lib/Support/APFloat.cpp", line 2731.11: 1540-0432 (S) The
qualified declarator "llvm::hash_value" must refer to an existing
declaration.
The draft standard says in section 7.3.1.2 "Namespace member definitions":
"... If a friend declaration in a non-local class first declares a class
or function95 the friend class or function is a member of the innermost
enclosing namespace. The name of the friend is not found by unqualified
lookup (3.4.1) or by qualified lookup (3.4.3) until a matching
declaration is provided in that namespace scope (either before or after
the class definition granting friendship). ..."
I conclude that the declaration is required for conformance with the C++
standard. The attached patch resolves the problem.
Please review and commit if it looks good.
Regards
Kai
-------------- next part --------------
diff --git a/include/llvm/ADT/APFloat.h b/include/llvm/ADT/APFloat.h
index 5a625a4..bcd1f6d 100644
--- a/include/llvm/ADT/APFloat.h
+++ b/include/llvm/ADT/APFloat.h
@@ -463,6 +463,9 @@ namespace llvm {
exponent_t exponent2 : 11;
unsigned int sign2: 1;
};
+
+ // See friend declaration above.
+ hash_code hash_value(const APFloat &Arg);
} /* namespace llvm */
#endif /* LLVM_FLOAT_H */
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index 90114e2..ca6e1f6 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -1780,6 +1780,8 @@ inline APInt Not(const APInt& APIVal) {
} // End of APIntOps namespace
+ // See friend declaration above.
+ hash_code hash_value(const APInt &Arg);
} // End of llvm namespace
#endif
More information about the llvm-commits
mailing list