Home | History | Annotate | Download | only in Parse
      1 //===---- ParserPragmas.h - Language specific pragmas -----------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines #pragma handlers for language specific pragmas.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_CLANG_PARSE_PARSEPRAGMA_H
     15 #define LLVM_CLANG_PARSE_PARSEPRAGMA_H
     16 
     17 #include "clang/Lex/Pragma.h"
     18 
     19 namespace clang {
     20   class Sema;
     21   class Parser;
     22 
     23 class PragmaAlignHandler : public PragmaHandler {
     24   Sema &Actions;
     25 public:
     26   explicit PragmaAlignHandler(Sema &A) : PragmaHandler("align"), Actions(A) {}
     27 
     28   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     29                             Token &FirstToken);
     30 };
     31 
     32 class PragmaGCCVisibilityHandler : public PragmaHandler {
     33   Sema &Actions;
     34 public:
     35   explicit PragmaGCCVisibilityHandler(Sema &A) : PragmaHandler("visibility"),
     36                                                  Actions(A) {}
     37 
     38   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     39                             Token &FirstToken);
     40 };
     41 
     42 class PragmaOptionsHandler : public PragmaHandler {
     43   Sema &Actions;
     44 public:
     45   explicit PragmaOptionsHandler(Sema &A) : PragmaHandler("options"),
     46                                            Actions(A) {}
     47 
     48   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     49                             Token &FirstToken);
     50 };
     51 
     52 class PragmaPackHandler : public PragmaHandler {
     53   Sema &Actions;
     54 public:
     55   explicit PragmaPackHandler(Sema &A) : PragmaHandler("pack"),
     56                                         Actions(A) {}
     57 
     58   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     59                             Token &FirstToken);
     60 };
     61 
     62 class PragmaMSStructHandler : public PragmaHandler {
     63   Sema &Actions;
     64 public:
     65   explicit PragmaMSStructHandler(Sema &A) : PragmaHandler("ms_struct"),
     66   Actions(A) {}
     67 
     68   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     69                             Token &FirstToken);
     70 };
     71 
     72 class PragmaUnusedHandler : public PragmaHandler {
     73   Sema &Actions;
     74   Parser &parser;
     75 public:
     76   PragmaUnusedHandler(Sema &A, Parser& p)
     77     : PragmaHandler("unused"), Actions(A), parser(p) {}
     78 
     79   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     80                             Token &FirstToken);
     81 };
     82 
     83 class PragmaWeakHandler : public PragmaHandler {
     84   Sema &Actions;
     85 public:
     86   explicit PragmaWeakHandler(Sema &A)
     87     : PragmaHandler("weak"), Actions(A) {}
     88 
     89   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     90                             Token &FirstToken);
     91 };
     92 
     93 class PragmaOpenCLExtensionHandler : public PragmaHandler {
     94   Sema &Actions;
     95   Parser &parser;
     96 public:
     97   PragmaOpenCLExtensionHandler(Sema &S, Parser& p) :
     98     PragmaHandler("EXTENSION"), Actions(S), parser(p) {}
     99   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
    100                             Token &FirstToken);
    101 };
    102 
    103 
    104 class PragmaFPContractHandler : public PragmaHandler {
    105   Sema &Actions;
    106   Parser &parser;
    107 public:
    108   PragmaFPContractHandler(Sema &S, Parser& p) :
    109     PragmaHandler("FP_CONTRACT"), Actions(S), parser(p) {}
    110   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
    111                             Token &FirstToken);
    112 };
    113 
    114 
    115 }  // end namespace clang
    116 
    117 #endif
    118