diff options
Diffstat (limited to 'clang/tools/libclang/CXCursor.cpp')
| -rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index 53145a67194..6e5f61f4495 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -65,7 +65,6 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, ASTUnit *TU) { case Stmt::CompoundStmtClass: case Stmt::CaseStmtClass: case Stmt::DefaultStmtClass: - case Stmt::LabelStmtClass: case Stmt::IfStmtClass: case Stmt::SwitchStmtClass: case Stmt::WhileStmtClass: @@ -90,6 +89,10 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, ASTUnit *TU) { K = CXCursor_UnexposedStmt; break; + case Stmt::LabelStmtClass: + K = CXCursor_LabelStmt; + break; + case Stmt::PredefinedExprClass: case Stmt::IntegerLiteralClass: case Stmt::FloatingLiteralClass: @@ -153,6 +156,7 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent, ASTUnit *TU) { case Stmt::BlockExprClass: K = CXCursor_UnexposedExpr; break; + case Stmt::DeclRefExprClass: case Stmt::BlockDeclRefExprClass: // FIXME: UnresolvedLookupExpr? @@ -357,6 +361,23 @@ MacroInstantiation *cxcursor::getCursorMacroInstantiation(CXCursor C) { return static_cast<MacroInstantiation *>(C.data[0]); } +CXCursor cxcursor::MakeCursorLabelRef(LabelStmt *Label, SourceLocation Loc, + ASTUnit *TU) { + + assert(Label && TU && "Invalid arguments!"); + void *RawLoc = reinterpret_cast<void *>(Loc.getRawEncoding()); + CXCursor C = { CXCursor_LabelRef, { Label, RawLoc, TU } }; + return C; +} + +std::pair<LabelStmt*, SourceLocation> +cxcursor::getCursorLabelRef(CXCursor C) { + assert(C.kind == CXCursor_LabelRef); + return std::make_pair(static_cast<LabelStmt *>(C.data[0]), + SourceLocation::getFromRawEncoding( + reinterpret_cast<uintptr_t>(C.data[1]))); +} + Decl *cxcursor::getCursorDecl(CXCursor Cursor) { return (Decl *)Cursor.data[0]; } |

