Dump the value calculated by a constant expression when dumping the AST to JSON.
llvm-svn: 363866
This commit is contained in:
parent
9f42845187
commit
91f7265759
|
@ -250,6 +250,7 @@ public:
|
|||
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *ULE);
|
||||
void VisitAddrLabelExpr(const AddrLabelExpr *ALE);
|
||||
void VisitCXXTypeidExpr(const CXXTypeidExpr *CTE);
|
||||
void VisitConstantExpr(const ConstantExpr *CE);
|
||||
|
||||
void VisitIntegerLiteral(const IntegerLiteral *IL);
|
||||
void VisitCharacterLiteral(const CharacterLiteral *CL);
|
||||
|
|
|
@ -975,6 +975,15 @@ void JSONNodeDumper::VisitCXXTypeidExpr(const CXXTypeidExpr *CTE) {
|
|||
}
|
||||
}
|
||||
|
||||
void JSONNodeDumper::VisitConstantExpr(const ConstantExpr *CE) {
|
||||
if (CE->getResultAPValueKind() != APValue::None) {
|
||||
std::string Str;
|
||||
llvm::raw_string_ostream OS(Str);
|
||||
CE->getAPValueResult().printPretty(OS, Ctx, CE->getType());
|
||||
JOS.attribute("value", OS.str());
|
||||
}
|
||||
}
|
||||
|
||||
void JSONNodeDumper::VisitIntegerLiteral(const IntegerLiteral *IL) {
|
||||
JOS.attribute("value",
|
||||
IL->getValue().toString(
|
||||
|
|
|
@ -528,6 +528,7 @@ void func(int val) {
|
|||
// CHECK-NEXT: "qualType": "bool"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: "valueCategory": "rvalue",
|
||||
// CHECK-NEXT: "value": "true",
|
||||
// CHECK-NEXT: "inner": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
|
|
|
@ -2951,6 +2951,7 @@ void TestIteration() {
|
|||
// CHECK-NEXT: "qualType": "bool"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: "valueCategory": "rvalue",
|
||||
// CHECK-NEXT: "value": "true",
|
||||
// CHECK-NEXT: "inner": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
|
@ -3150,6 +3151,7 @@ void TestIteration() {
|
|||
// CHECK-NEXT: "qualType": "bool"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: "valueCategory": "rvalue",
|
||||
// CHECK-NEXT: "value": "true",
|
||||
// CHECK-NEXT: "inner": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
||||
|
|
Loading…
Reference in New Issue