[cfe-commits] r44624 - in /cfe/trunk: Basic/LangOptions.cpp include/clang/Basic/LangOptions.h
Ted Kremenek
kremenek at apple.com
Wed Dec 5 11:06:15 PST 2007
Author: kremenek
Date: Wed Dec 5 13:06:15 2007
New Revision: 44624
URL: http://llvm.org/viewvc/llvm-project?rev=44624&view=rev
Log:
Implemented serialization of LangOptions.
Added:
cfe/trunk/Basic/LangOptions.cpp
Modified:
cfe/trunk/include/clang/Basic/LangOptions.h
Added: cfe/trunk/Basic/LangOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/LangOptions.cpp?rev=44624&view=auto
==============================================================================
--- cfe/trunk/Basic/LangOptions.cpp (added)
+++ cfe/trunk/Basic/LangOptions.cpp Wed Dec 5 13:06:15 2007
@@ -0,0 +1,58 @@
+//===--- SourceManager.cpp - Track and cache source files -----------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Ted Kremenek and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the methods for LangOptions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/LangOptions.h"
+#include "llvm/Bitcode/Serialize.h"
+#include "llvm/Bitcode/Deserialize.h"
+
+using namespace clang;
+
+void LangOptions::Emit(llvm::Serializer& S) const {
+ S.EmitBool((bool) Trigraphs);
+ S.EmitBool((bool) BCPLComment);
+ S.EmitBool((bool) DollarIdents);
+ S.EmitBool((bool) Digraphs);
+ S.EmitBool((bool) HexFloats);
+ S.EmitBool((bool) C99);
+ S.EmitBool((bool) Microsoft);
+ S.EmitBool((bool) CPlusPlus);
+ S.EmitBool((bool) CPlusPlus0x);
+ S.EmitBool((bool) NoExtensions);
+ S.EmitBool((bool) CXXOperatorNames);
+ S.EmitBool((bool) ObjC1);
+ S.EmitBool((bool) ObjC2);
+ S.EmitBool((bool) PascalStrings);
+ S.EmitBool((bool) Boolean);
+ S.EmitBool((bool) WritableStrings);
+ S.EmitBool((bool) LaxVectorConversions);
+}
+
+void LangOptions::Read(llvm::Deserializer& D) {
+ Trigraphs = D.ReadBool() ? 1 : 0;
+ BCPLComment = D.ReadBool() ? 1 : 0;
+ DollarIdents = D.ReadBool() ? 1 : 0;
+ Digraphs = D.ReadBool() ? 1 : 0;
+ HexFloats = D.ReadBool() ? 1 : 0;
+ C99 = D.ReadBool() ? 1 : 0;
+ Microsoft = D.ReadBool() ? 1 : 0;
+ CPlusPlus = D.ReadBool() ? 1 : 0;
+ CPlusPlus0x = D.ReadBool() ? 1 : 0;
+ NoExtensions = D.ReadBool() ? 1 : 0;
+ CXXOperatorNames = D.ReadBool() ? 1 : 0;
+ ObjC1 = D.ReadBool() ? 1 : 0;
+ ObjC2 = D.ReadBool() ? 1 : 0;
+ PascalStrings = D.ReadBool() ? 1 : 0;
+ Boolean = D.ReadBool() ? 1 : 0;
+ WritableStrings = D.ReadBool() ? 1 : 0;
+ LaxVectorConversions = D.ReadBool() ? 1 : 0;
+}
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=44624&r1=44623&r2=44624&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Wed Dec 5 13:06:15 2007
@@ -14,6 +14,8 @@
#ifndef LLVM_CLANG_LANGOPTIONS_H
#define LLVM_CLANG_LANGOPTIONS_H
+#include "llvm/Bitcode/SerializationFwd.h"
+
namespace clang {
/// LangOptions - This class keeps track of the various options that can be
@@ -46,6 +48,12 @@
CXXOperatorNames = PascalStrings = Boolean = WritableStrings = 0;
LaxVectorConversions = 0;
}
+
+ /// Emit - Emit this LangOptions object to bitcode.
+ void Emit(llvm::Serializer& S) const;
+
+ /// Read - Read new values for this LangOption object from bitcode.
+ void Read(llvm::Deserializer& S);
};
} // end namespace clang
More information about the cfe-commits
mailing list