[libclang] Provide location for attributes and expose 'packed' attribute.

Patch by Loïc Jaquemet!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191345 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 5d376ae..b40a913 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3348,6 +3348,10 @@
     return cxstring::createDup(AA->getLabel());
   }
 
+  if (C.kind == CXCursor_PackedAttr) {
+    return cxstring::createRef("packed");
+  }
+
   return cxstring::createEmpty();
 }
 
@@ -3765,6 +3769,8 @@
     return cxstring::createRef("attribute(annotate)");
   case CXCursor_AsmLabelAttr:
     return cxstring::createRef("asm label");
+  case CXCursor_PackedAttr:
+    return cxstring::createRef("attribute(packed)");
   case CXCursor_PreprocessingDirective:
     return cxstring::createRef("preprocessing directive");
   case CXCursor_MacroDefinition:
@@ -4172,6 +4178,12 @@
     return cxloc::translateSourceLocation(getCursorContext(C), L);
   }
 
+  if (clang_isAttribute(C.kind)) {
+    SourceLocation L
+      = cxcursor::getCursorAttr(C)->getLocation();
+    return cxloc::translateSourceLocation(getCursorContext(C), L);
+  }
+
   if (!clang_isDeclaration(C.kind))
     return clang_getNullLocation();