diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-16 19:06:07 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-16 19:06:07 +0000 |
commit | 08d6e032a2a0a8656d12b3b7b93942987bb12eb7 (patch) | |
tree | 632b74cc7329419d23c53cb941e19ed16a587d5b /include/clang/AST/APValue.h | |
parent | d3d8548e75f3fb6db53ed0927c1df30d78f4ce1d (diff) | |
download | clang-08d6e032a2a0a8656d12b3b7b93942987bb12eb7.tar.gz clang-08d6e032a2a0a8656d12b3b7b93942987bb12eb7.tar.bz2 clang-08d6e032a2a0a8656d12b3b7b93942987bb12eb7.tar.xz |
C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit
argument to driver and frontend, to control the maximum number of notes so
produced (default 10). Fix APValue printing to be able to pretty-print all
APValue types, and move the testing for this functionality from a unittest to
a -verify test now that it's visible in clang's output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/APValue.h')
-rw-r--r-- | include/clang/AST/APValue.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h index cca00371c2..151956903c 100644 --- a/include/clang/AST/APValue.h +++ b/include/clang/AST/APValue.h @@ -21,6 +21,7 @@ #include "llvm/ADT/PointerUnion.h" namespace clang { + class ASTContext; class CharUnits; class DiagnosticBuilder; class Expr; @@ -28,6 +29,7 @@ namespace clang { class Decl; class ValueDecl; class CXXRecordDecl; + class QualType; /// APValue - This class implements a discriminated union of [uninitialized] /// [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset], @@ -171,8 +173,11 @@ public: bool isUnion() const { return Kind == Union; } bool isMemberPointer() const { return Kind == MemberPointer; } - void print(raw_ostream &OS) const; void dump() const; + void dump(raw_ostream &OS) const; + + void printPretty(raw_ostream &OS, ASTContext &Ctx, QualType Ty) const; + std::string getAsString(ASTContext &Ctx, QualType Ty) const; APSInt &getInt() { assert(isInt() && "Invalid accessor"); @@ -394,15 +399,6 @@ private: ArrayRef<const CXXRecordDecl*> Path); }; -inline raw_ostream &operator<<(raw_ostream &OS, const APValue &V) { - V.print(OS); - return OS; -} - -// Writes a concise representation of V to DB, in a single << operation. -const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, - const APValue &V); - } // end namespace clang. #endif |