diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 3257664..11334bc 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -1974,6 +1974,19 @@ typedef struct {
 CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
 
 /**
+ * \brief Retrieve an integer value from a CXCursor (if any).
+ *
+ * For example, this can be used to:
+ *
+ * * Get the value of an enumeration constant.
+ * * Get the value of a currently unexposed declaration attribute
+ *   (for example, inline or calling convention attributes).
+ * * Get the value of an initializer or bit field width
+ *   from a currently unexposed expression.
+ */
+CINDEX_LINKAGE int clang_getCursorValue(CXCursor C);
+
+/**
  * \determine Determine whether two CXTypes represent the same type.
  *
  * \returns non-zero if the CXTypes represent the same type and 
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 51749d7..1980c16 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3325,6 +3325,35 @@ CXString clang_getCursorDisplayName(CXCursor C) {
   
   return clang_getCursorSpelling(C);
 }
+
+int clang_getCursorValue(CXCursor C)
+{
+    int result = 0;
+
+    if (C.kind == CXCursor_EnumConstantDecl) {
+        Decl * D = getCursorDecl(C);
+
+        if (isa<EnumConstantDecl>(D)) { // this check may not be needed
+        	llvm::APSInt Value = static_cast<EnumConstantDecl *>(D)->getInitVal();
+
+        	result = (int) Value.getSExtValue();
+        }
+    }
+    else if (C.kind == CXCursor_UnexposedAttr) {
+    	Attr * A = getCursorAttr(C);
+
+    	result = (int) A->getKind();
+    }
+    else if (C.kind == CXCursor_UnexposedExpr) {
+    	Expr * E = getCursorExpr(C);
+        CXTranslationUnit tu = getCursorTU(C);
+        ASTUnit *CXXUnit = static_cast<ASTUnit*>(tu->TUData);
+        llvm::APSInt Value = E->EvaluateAsInt(CXXUnit->getASTContext());
+
+        result = (int) Value.getSExtValue();
+    }
+    return result;
+}
   
 CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
   switch (Kind) {
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index cc6c326..888fa04 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -73,6 +73,7 @@ clang_getCursorSemanticParent
 clang_getCursorSpelling
 clang_getCursorType
 clang_getCursorUSR
+clang_getCursorValue
 clang_getDeclObjCTypeEncoding
 clang_getDefinitionSpellingAndExtent
 clang_getDiagnostic
