00001 //===-- ast/Pragma.cpp ---------------------------------------- -*- 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 #include "comma/ast/Expr.h" 00010 #include "comma/ast/Pragma.h" 00011 00012 #include <cstring> 00013 00014 using namespace comma; 00015 00016 PragmaImport::PragmaImport(Location loc, Convention convention, 00017 IdentifierInfo *entity, Expr *externalName) 00018 : Pragma(pragma::Import, loc), 00019 convention(convention), 00020 entity(entity), 00021 externalNameExpr(externalName) 00022 { 00023 externalName->staticStringValue(this->externalName); 00024 } 00025 00026 PragmaImport::Convention PragmaImport::getConventionID(llvm::StringRef &ref) 00027 { 00028 // There is only one convention supported ATM: C. 00029 if (ref.size() == 1 && ref[0] == 'C') 00030 return C; 00031 return UNKNOWN_CONVENTION; 00032 }