GrislyMe created this revision.
GrislyMe added reviewers: abdulras, gribozavr.
GrislyMe added a project: clang.
Herald added a subscriber: arphaman.
Herald added a project: All.
GrislyMe requested review of this revision.
Herald added a subscriber: cfe-commits.

Return the IntegerLiteral cursor value in a string.
The value will be represented in base-10 and unsigned.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139178

Files:
  clang/tools/libclang/CIndex.cpp


Index: clang/tools/libclang/CIndex.cpp
===================================================================
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -4937,6 +4937,13 @@
       SLit->outputString(OS);
       return cxstring::createDup(OS.str());
     }
+    if (C.kind == CXCursor_IntegerLiteral) {
+      SmallString<64> Buf;
+      if (const IntegerLiteral *ILit = dyn_cast<IntegerLiteral>(E)) {
+        ILit->getValue().toString(Buf, 10, true);
+        return cxstring::createDup(Buf);
+      }
+    }
 
     const Decl *D = getDeclFromExpr(getCursorExpr(C));
     if (D)


Index: clang/tools/libclang/CIndex.cpp
===================================================================
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -4937,6 +4937,13 @@
       SLit->outputString(OS);
       return cxstring::createDup(OS.str());
     }
+    if (C.kind == CXCursor_IntegerLiteral) {
+      SmallString<64> Buf;
+      if (const IntegerLiteral *ILit = dyn_cast<IntegerLiteral>(E)) {
+        ILit->getValue().toString(Buf, 10, true);
+        return cxstring::createDup(Buf);
+      }
+    }
 
     const Decl *D = getDeclFromExpr(getCursorExpr(C));
     if (D)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to