From a9ab5d6bcf42dfd4f058ee3b1fbb32456c0bdfe8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Nov 2008 07:35:53 +0000 Subject: [PATCH] move some APValue methods out of line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59410 91177308-0d34-0410-b5e6-96231b3b80d8 --- clang.xcodeproj/project.pbxproj | 4 ++++ include/clang/AST/APValue.h | 41 ++------------------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index 6a3f9e8a97..88312be4b7 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -160,6 +160,7 @@ DE85CDAC0D838C120070E26E /* PPMacroExpansion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE85CDAB0D838C120070E26E /* PPMacroExpansion.cpp */; }; DE85CDB00D838C390070E26E /* PPDirectives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE85CDAF0D838C390070E26E /* PPDirectives.cpp */; }; DE85CDB60D839BAE0070E26E /* PPLexerChange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE85CDB50D839BAE0070E26E /* PPLexerChange.cpp */; }; + DE8823CB0ED0046600CBC30A /* APValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE8823CA0ED0046600CBC30A /* APValue.cpp */; }; DE928B130C05659200231DA4 /* ModuleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE928B120C05659200231DA4 /* ModuleBuilder.cpp */; }; DE928B200C0565B000231DA4 /* ModuleBuilder.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE928B1F0C0565B000231DA4 /* ModuleBuilder.h */; }; DE928B7D0C0A615100231DA4 /* CodeGenModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE928B7C0C0A615100231DA4 /* CodeGenModule.h */; }; @@ -508,6 +509,7 @@ DE85CDAF0D838C390070E26E /* PPDirectives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PPDirectives.cpp; sourceTree = ""; }; DE85CDB50D839BAE0070E26E /* PPLexerChange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PPLexerChange.cpp; sourceTree = ""; }; DE8822350EC80C0A00CBC30A /* CGBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGBuilder.h; path = lib/CodeGen/CGBuilder.h; sourceTree = ""; }; + DE8823CA0ED0046600CBC30A /* APValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = APValue.cpp; path = lib/AST/APValue.cpp; sourceTree = ""; }; DE928B120C05659200231DA4 /* ModuleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleBuilder.cpp; path = lib/CodeGen/ModuleBuilder.cpp; sourceTree = ""; tabWidth = 2; }; DE928B1F0C0565B000231DA4 /* ModuleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ModuleBuilder.h; path = clang/CodeGen/ModuleBuilder.h; sourceTree = ""; }; DE928B7C0C0A615100231DA4 /* CodeGenModule.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = CodeGenModule.h; path = lib/CodeGen/CodeGenModule.h; sourceTree = ""; tabWidth = 2; }; @@ -979,6 +981,7 @@ DEC8D9920A9433F400353FCA /* AST */ = { isa = PBXGroup; children = ( + DE8823CA0ED0046600CBC30A /* APValue.cpp */, 35BB2D7E0D19954000944DB5 /* ASTConsumer.cpp */, DE1732FF0B068B700080B521 /* ASTContext.cpp */, DED677C80B6C854100AAD4A3 /* Builtins.cpp */, @@ -1325,6 +1328,7 @@ 35E1946A0ECB82FB00F21733 /* SemaNamedCast.cpp in Sources */, 35E1946D0ECB83C100F21733 /* PTHLexer.cpp in Sources */, 3537AA0E0ECD08A4008F7CDC /* PreprocessorLexer.cpp in Sources */, + DE8823CB0ED0046600CBC30A /* APValue.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h index 2360473c55..eac97a613e 100644 --- a/include/clang/AST/APValue.h +++ b/include/clang/AST/APValue.h @@ -173,47 +173,10 @@ public: ((LV*)(void*)Data)->Offset = O; } - const APValue &operator=(const APValue &RHS) { - if (Kind != RHS.Kind) { - MakeUninit(); - if (RHS.isInt()) - MakeInt(); - else if (RHS.isFloat()) - MakeFloat(); - else if (RHS.isComplexInt()) - MakeComplexInt(); - else if (RHS.isComplexFloat()) - MakeComplexFloat(); - else if (RHS.isLValue()) - MakeLValue(); - } - if (isInt()) - setInt(RHS.getInt()); - else if (isFloat()) - setFloat(RHS.getFloat()); - else if (isComplexInt()) - setComplexInt(RHS.getComplexIntReal(), RHS.getComplexIntImag()); - else if (isComplexFloat()) - setComplexFloat(RHS.getComplexFloatReal(), RHS.getComplexFloatImag()); - else if (isLValue()) - setLValue(RHS.getLValueBase(), RHS.getLValueOffset()); - return *this; - } + const APValue &operator=(const APValue &RHS); private: - void MakeUninit() { - if (Kind == Int) - ((APSInt*)(void*)Data)->~APSInt(); - else if (Kind == Float) - ((APFloat*)(void*)Data)->~APFloat(); - else if (Kind == ComplexInt) - ((ComplexAPSInt*)(void*)Data)->~ComplexAPSInt(); - else if (Kind == ComplexFloat) - ((ComplexAPFloat*)(void*)Data)->~ComplexAPFloat(); - else if (Kind == LValue) { - ((LV*)(void*)Data)->~LV(); - } - } + void MakeUninit(); void MakeInt() { assert(isUninit() && "Bad state change"); new ((void*)Data) APSInt(1);