diff options
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/PCHBitCodes.h | 14 | ||||
-rw-r--r-- | include/clang/Frontend/PCHReader.h | 13 | ||||
-rw-r--r-- | include/clang/Frontend/PCHWriter.h | 12 |
3 files changed, 39 insertions, 0 deletions
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h index a218a5fcf6..98d27a0916 100644 --- a/include/clang/Frontend/PCHBitCodes.h +++ b/include/clang/Frontend/PCHBitCodes.h @@ -375,6 +375,20 @@ namespace clang { STMT_STOP, /// \brief A NULL expression. STMT_NULL_PTR, + /// \brief A NullStmt record. + STMT_NULL, + /// \brief A CompoundStmt record. + STMT_COMPOUND, + /// \brief A CaseStmt record. + STMT_CASE, + /// \brief A DefaultStmt record. + STMT_DEFAULT, + /// \brief An IfStmt record. + STMT_IF, + /// \brief A SwitchStmt record. + STMT_SWITCH, + /// \brief A BreakStmt record. + STMT_BREAK, /// \brief A PredefinedExpr record. EXPR_PREDEFINED, /// \brief A DeclRefExpr record. diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h index 995a1d563f..07531df1f3 100644 --- a/include/clang/Frontend/PCHReader.h +++ b/include/clang/Frontend/PCHReader.h @@ -26,6 +26,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/Support/DataTypes.h" +#include <map> #include <string> #include <utility> #include <vector> @@ -41,6 +42,7 @@ class Attr; class Decl; class DeclContext; class Preprocessor; +class SwitchCase; /// \brief Reads a precompiled head containing the contents of a /// translation unit. @@ -126,6 +128,10 @@ private: /// file. llvm::SmallVector<uint64_t, 16> ExternalDefinitions; + /// \brief Mapping from switch-case IDs in the PCH file to + /// switch-case statements. + std::map<unsigned, SwitchCase *> SwitchCaseStmts; + PCHReadResult ReadPCHBlock(); bool CheckPredefinesBuffer(const char *PCHPredef, unsigned PCHPredefLen, @@ -241,6 +247,13 @@ public: /// \brief Retrieve the AST context that this PCH reader /// supplements. ASTContext &getContext() { return Context; } + + /// \brief Record that the given ID maps to the given switch-case + /// statement. + void RecordSwitchCaseID(SwitchCase *SC, unsigned ID); + + /// \brief Retrieve the switch-case statement with the given ID. + SwitchCase *getSwitchCaseWithID(unsigned ID); }; } // end namespace clang diff --git a/include/clang/Frontend/PCHWriter.h b/include/clang/Frontend/PCHWriter.h index 4af64e6ee1..5828637b04 100644 --- a/include/clang/Frontend/PCHWriter.h +++ b/include/clang/Frontend/PCHWriter.h @@ -20,6 +20,7 @@ #include "clang/Frontend/PCHBitCodes.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include <map> #include <queue> namespace llvm { @@ -33,6 +34,7 @@ namespace clang { class ASTContext; class Preprocessor; class SourceManager; +class SwitchCase; class TargetInfo; /// \brief Writes a precompiled header containing the contents of a @@ -108,6 +110,9 @@ private: /// declaration or type. llvm::SmallVector<Stmt *, 8> StmtsToEmit; + /// \brief Mapping from SwitchCase statements to IDs. + std::map<SwitchCase *, unsigned> SwitchCaseIDs; + void WriteTargetTriple(const TargetInfo &Target); void WriteLanguageOptions(const LangOptions &LangOpts); void WriteSourceManagerBlock(SourceManager &SourceMgr); @@ -170,6 +175,13 @@ public: /// \brief Flush all of the statements and expressions that have /// been added to the queue via AddStmt(). void FlushStmts(); + + /// \brief Record an ID for the given switch-case statement. + unsigned RecordSwitchCaseID(SwitchCase *S); + + /// \brief Retrieve the ID for the given switch-case statement. + unsigned getSwitchCaseID(SwitchCase *S); + }; } // end namespace clang |