00001 //===-- ast/ExceptionRef.h ------------------------------------ -*- C++ -*-===// 00002 // 00003 // This file is distributed under the MIT license. See LICENSE.txt for details. 00004 // 00005 // Copyright (C) 2009, Stephen Wilson 00006 // 00007 //===----------------------------------------------------------------------===// 00008 00009 #ifndef COMMA_AST_EXCEPTIONREF_HDR_GUARD 00010 #define COMMA_AST_EXCEPTIONREF_HDR_GUARD 00011 00012 //===----------------------------------------------------------------------===// 00016 //===----------------------------------------------------------------------===// 00017 00018 #include "comma/ast/AstBase.h" 00019 #include "comma/ast/Decl.h" 00020 00021 namespace comma { 00022 00023 //===----------------------------------------------------------------------===// 00024 // ExceptionRef 00025 // 00030 class ExceptionRef : public Ast { 00031 00032 public: 00033 ExceptionRef(Location loc, ExceptionDecl *exception) 00034 : Ast(AST_ExceptionRef), loc(loc), exception(exception) { } 00035 00037 Location getLocation() const { return loc; } 00038 00040 00041 const ExceptionDecl *getException() const { return exception; } 00042 ExceptionDecl *getException() { return exception; } 00044 00046 void setException(ExceptionDecl *exception) { this->exception = exception; } 00047 00049 IdentifierInfo *getIdInfo() const { return exception->getIdInfo(); } 00050 00053 const char *getString() const { return exception->getString(); } 00054 00055 // Support isa/dyn_cast. 00056 static bool classof(const ExceptionRef *node) { return true; } 00057 static bool classof(const Ast *node) { 00058 return node->getKind() == AST_ExceptionRef; 00059 } 00060 00061 private: 00062 Location loc; 00063 ExceptionDecl *exception; 00064 }; 00065 00066 } // end comma namespace. 00067 00068 #endif 00069