//===--- Pragma.cpp - Pragma registration and handling --------------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the PragmaHandler/PragmaTable interfaces and implements// pragma related methods of the Preprocessor class.////===----------------------------------------------------------------------===//#include"clang/Lex/Pragma.h"#include"clang/Basic/FileManager.h"#include"clang/Basic/SourceManager.h"#include"clang/Lex/HeaderSearch.h"#include"clang/Lex/LexDiagnostic.h"#include"clang/Lex/LiteralSupport.h"#include"clang/Lex/MacroInfo.h"#include"clang/Lex/Preprocessor.h"#include"llvm/Support/CrashRecoveryContext.h"#include"llvm/Support/ErrorHandling.h"#include<algorithm>usingnamespaceclang;// Out-of-line destructor to provide a home for the class.PragmaHandler::~PragmaHandler(){}//===----------------------------------------------------------------------===//// EmptyPragmaHandler Implementation.//===----------------------------------------------------------------------===//EmptyPragmaHandler::EmptyPragmaHandler(){}voidEmptyPragmaHandler::HandlePragma(Preprocessor&PP,PragmaIntroducerKindIntroducer,Token&FirstToken){}//===----------------------------------------------------------------------===//// PragmaNamespace Implementation.//===----------------------------------------------------------------------===//PragmaNamespace::~PragmaNamespace(){for(llvm::StringMap<PragmaHandler*>::iteratorI=Handlers.begin(),E=Handlers.end();I!=E;++I)deleteI->second;}/// FindHandler - Check to see if there is already a handler for the/// specified name. If not, return the handler for the null identifier if it/// exists, otherwise return null. If IgnoreNull is true (the default) then/// the null handler isn't returned on failure to match.PragmaHandler*PragmaNamespace::FindHandler(StringRefName,boolIgnoreNull)const{if(PragmaHandler*Handler=Handlers.lookup(Name))returnHandler;returnIgnoreNull?0:Handlers.lookup(StringRef());}voidPragmaNamespace::AddPragma(PragmaHandler*Handler){assert(!Handlers.lookup(Handler->getName())&&"A handler with this name is already registered in this namespace");llvm::StringMapEntry<PragmaHandler*>&Entry=Handlers.GetOrCreateValue(Handler->getName());Entry.setValue(Handler);}voidPragmaNamespace::RemovePragmaHandler(PragmaHandler*Handler){assert(Handlers.lookup(Handler->getName())&&"Handler not registered in this namespace");Handlers.erase(Handler->getName());}voidPragmaNamespace::HandlePragma(Preprocessor