aboutsummaryrefslogtreecommitdiff
path: root/clang/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
commit16834f1cf9d59743b70a286f291b2c753dfae5bc (patch)
tree7318198f1e5e1920413c8896b712da412d1e0e3d /clang/tools
parentaff6a0caa2fc861cfa9ed70d0c1a4e280ccfba9f (diff)
downloadllvm-16834f1cf9d59743b70a286f291b2c753dfae5bc.zip
llvm-16834f1cf9d59743b70a286f291b2c753dfae5bc.tar.gz
llvm-16834f1cf9d59743b70a286f291b2c753dfae5bc.tar.bz2
[libclang] Provide location for attributes and expose 'packed' attribute.
Patch by Loïc Jaquemet! llvm-svn: 191345
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/libclang/CIndex.cpp12
-rw-r--r--clang/tools/libclang/CXCursor.cpp1
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 5d376ae..b40a913 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/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/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp
index 5aab944..c75c061 100644
--- a/clang/tools/libclang/CXCursor.cpp
+++ b/clang/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;