summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-09-25 00:14:38 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-09-25 00:14:38 +0000
commit513371129c834c143a50c3ca09bb581b7f0f6344 (patch)
tree89a3b7dfb08cefb2188c6b196ec3a00fccb25cf7 /tools
parentda8d37ce42d2db4e1e76ee6f7f38f10f6b0ef0f8 (diff)
downloadclang-513371129c834c143a50c3ca09bb581b7f0f6344.tar.gz
clang-513371129c834c143a50c3ca09bb581b7f0f6344.tar.bz2
clang-513371129c834c143a50c3ca09bb581b7f0f6344.tar.xz
[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
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/CIndex.cpp12
-rw-r--r--tools/libclang/CXCursor.cpp1
2 files changed, 13 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 5d376ae6ad..b40a913481 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3348,6 +3348,10 @@ CXString clang_getCursorSpelling(CXCursor C) {
return cxstring::createDup(AA->getLabel());
}
+ if (C.kind == CXCursor_PackedAttr) {
+ return cxstring::createRef("packed");
+ }
+
return cxstring::createEmpty();
}
@@ -3765,6 +3769,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
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 @@ CXSourceLocation clang_getCursorLocation(CXCursor C) {
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();
diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp
index 5aab94403d..c75c061cf4 100644
--- a/tools/libclang/CXCursor.cpp
+++ b/tools/libclang/CXCursor.cpp
@@ -49,6 +49,7 @@ static CXCursorKind GetCursorKind(const Attr *A) {
case attr::Override: return CXCursor_CXXOverrideAttr;
case attr::Annotate: return CXCursor_AnnotateAttr;
case attr::AsmLabel: return CXCursor_AsmLabelAttr;
+ case attr::Packed: return CXCursor_PackedAttr;
}
return CXCursor_UnexposedAttr;