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 public:
     25   explicit PragmaAlignHandler() : PragmaHandler("align") {}
     26 
     27   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     28                             Token &FirstToken);
     29 };
     30 
     31 class PragmaGCCVisibilityHandler : public PragmaHandler {
     32 public:
     33   explicit PragmaGCCVisibilityHandler() : PragmaHandler("visibility") {}
     34 
     35   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     36                             Token &FirstToken);
     37 };
     38 
     39 class PragmaOptionsHandler : public PragmaHandler {
     40 public:
     41   explicit PragmaOptionsHandler() : PragmaHandler("options") {}
     42 
     43   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     44                             Token &FirstToken);
     45 };
     46 
     47 class PragmaPackHandler : public PragmaHandler {
     48 public:
     49   explicit PragmaPackHandler() : PragmaHandler("pack") {}
     50 
     51   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     52                             Token &FirstToken);
     53 };
     54 
     55 class PragmaMSStructHandler : public PragmaHandler {
     56 public:
     57   explicit PragmaMSStructHandler() : PragmaHandler("ms_struct") {}
     58 
     59   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     60                             Token &FirstToken);
     61 };
     62 
     63 class PragmaUnusedHandler : public PragmaHandler {
     64 public:
     65   PragmaUnusedHandler() : PragmaHandler("unused") {}
     66 
     67   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     68                             Token &FirstToken);
     69 };
     70 
     71 class PragmaWeakHandler : public PragmaHandler {
     72 public:
     73   explicit PragmaWeakHandler() : PragmaHandler("weak") {}
     74 
     75   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     76                             Token &FirstToken);
     77 };
     78 
     79 class PragmaRedefineExtnameHandler : public PragmaHandler {
     80 public:
     81   explicit PragmaRedefineExtnameHandler() : PragmaHandler("redefine_extname") {}
     82 
     83   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     84                             Token &FirstToken);
     85 };
     86 
     87 class PragmaOpenCLExtensionHandler : public PragmaHandler {
     88 public:
     89   PragmaOpenCLExtensionHandler() : PragmaHandler("EXTENSION") {}
     90   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     91                             Token &FirstToken);
     92 };
     93 
     94 
     95 class PragmaFPContractHandler : public PragmaHandler {
     96 public:
     97   PragmaFPContractHandler() : PragmaHandler("FP_CONTRACT") {}
     98   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
     99                             Token &FirstToken);
    100 };
    101 
    102 class PragmaNoOpenMPHandler : public PragmaHandler {
    103 public:
    104   PragmaNoOpenMPHandler() : PragmaHandler("omp") { }
    105   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
    106                             Token &FirstToken);
    107 };
    108 
    109 class PragmaOpenMPHandler : public PragmaHandler {
    110 public:
    111   PragmaOpenMPHandler() : PragmaHandler("omp") { }
    112   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
    113                             Token &FirstToken);
    114 };
    115 
    116 /// PragmaCommentHandler - "\#pragma comment ...".
    117 class PragmaCommentHandler : public PragmaHandler {
    118 public:
    119   PragmaCommentHandler(Sema &Actions)
    120     : PragmaHandler("comment"), Actions(Actions) {}
    121   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
    122                             Token &FirstToken);
    123 private:
    124   Sema &Actions;
    125 };
    126 
    127 class PragmaDetectMismatchHandler : public PragmaHandler {
    128 public:
    129   PragmaDetectMismatchHandler(Sema &Actions)
    130     : PragmaHandler("detect_mismatch"), Actions(Actions) {}
    131   virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
    132                             Token &FirstToken);
    133 private:
    134   Sema &Actions;
    135 };
    136 
    137 }  // end namespace clang
    138 
    139 #endif
    140