Переглянути джерело

[linux-port] More compile improvement (helps GCC). (#1310)

GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly.

Removed some PointerStatus:: prefixes from references within the
class itself which upsets GCC.

HLSL changes excluded Transforms/Instrumentation directory entirely
including BoundsChecking. However it didn't excluder one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references the missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.
Greg Roth 7 роки тому
батько
коміт
6ddc8622d9

+ 1 - 1
include/dxc/HLSL/DxilOperations.h

@@ -129,7 +129,7 @@ private:
 private:
 private:
   // Static properties.
   // Static properties.
   struct OpCodeProperty {
   struct OpCodeProperty {
-    OpCode OpCode;
+    OpCode opCode;
     const char *pOpCodeName;
     const char *pOpCodeName;
     OpCodeClass opCodeClass;
     OpCodeClass opCodeClass;
     const char *pOpCodeClassName;
     const char *pOpCodeClassName;

+ 1 - 1
lib/HLSL/DxilOperations.cpp

@@ -347,7 +347,7 @@ bool OP::IsOverloadLegal(OpCode opCode, Type *pType) {
 
 
 bool OP::CheckOpCodeTable() {
 bool OP::CheckOpCodeTable() {
   for (unsigned i = 0; i < (unsigned)OpCode::NumOpCodes; i++) {
   for (unsigned i = 0; i < (unsigned)OpCode::NumOpCodes; i++) {
-    if ((unsigned)m_OpCodeProps[i].OpCode != i)
+    if ((unsigned)m_OpCodeProps[i].opCode != i)
       return false;
       return false;
   }
   }
 
 

+ 8 - 8
lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp

@@ -3662,10 +3662,10 @@ struct PointerStatus {
         AccessingFunction(nullptr), HasMultipleAccessingFunctions(false),
         AccessingFunction(nullptr), HasMultipleAccessingFunctions(false),
         Size(size) {}
         Size(size) {}
   void MarkAsStored() {
   void MarkAsStored() {
-    storedType = PointerStatus::StoredType::Stored;
+    storedType = StoredType::Stored;
     StoredOnceValue = nullptr;
     StoredOnceValue = nullptr;
   }
   }
-  void MarkAsLoaded() { loadedType = PointerStatus::LoadedType::Loaded; }
+  void MarkAsLoaded() { loadedType = LoadedType::Loaded; }
 };
 };
 
 
 void PointerStatus::analyzePointer(const Value *V, PointerStatus &PS,
 void PointerStatus::analyzePointer(const Value *V, PointerStatus &PS,
@@ -3696,8 +3696,8 @@ void PointerStatus::analyzePointer(const Value *V, PointerStatus &PS,
         }
         }
         if (MC->getRawDest() == V) {
         if (MC->getRawDest() == V) {
           if (bFullCopy &&
           if (bFullCopy &&
-              PS.storedType == PointerStatus::StoredType::NotStored) {
-            PS.storedType = PointerStatus::StoredType::MemcopyDestOnce;
+              PS.storedType == StoredType::NotStored) {
+            PS.storedType = StoredType::MemcopyDestOnce;
             PS.StoringMemcpy = MI;
             PS.StoringMemcpy = MI;
           } else {
           } else {
             PS.MarkAsStored();
             PS.MarkAsStored();
@@ -3705,8 +3705,8 @@ void PointerStatus::analyzePointer(const Value *V, PointerStatus &PS,
           }
           }
         } else if (MC->getRawSource() == V) {
         } else if (MC->getRawSource() == V) {
           if (bFullCopy &&
           if (bFullCopy &&
-              PS.loadedType == PointerStatus::LoadedType::NotLoaded) {
-            PS.loadedType = PointerStatus::LoadedType::MemcopySrcOnce;
+              PS.loadedType == LoadedType::NotLoaded) {
+            PS.loadedType = LoadedType::MemcopySrcOnce;
             PS.LoadingMemcpy = MI;
             PS.LoadingMemcpy = MI;
           } else {
           } else {
             PS.MarkAsLoaded();
             PS.MarkAsLoaded();
@@ -3732,8 +3732,8 @@ void PointerStatus::analyzePointer(const Value *V, PointerStatus &PS,
     } else if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
     } else if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
       Value *V = SI->getOperand(0);
       Value *V = SI->getOperand(0);
 
 
-      if (PS.storedType == PointerStatus::StoredType::NotStored) {
-        PS.storedType = PointerStatus::StoredType::StoredOnce;
+      if (PS.storedType == StoredType::NotStored) {
+        PS.storedType = StoredType::StoredOnce;
         PS.StoredOnceValue = V;
         PS.StoredOnceValue = V;
       } else {
       } else {
         PS.MarkAsStored();
         PS.MarkAsStored();

+ 2 - 0
tools/clang/lib/CodeGen/BackendUtil.cpp

@@ -202,10 +202,12 @@ static void addAddDiscriminatorsPass(const PassManagerBuilder &Builder,
   PM.add(createAddDiscriminatorsPass());
   PM.add(createAddDiscriminatorsPass());
 }
 }
 
 
+#ifdef MS_ENABLE_OBJCARC // HLSL Change
 static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
 static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
                                     legacy::PassManagerBase &PM) {
                                     legacy::PassManagerBase &PM) {
   PM.add(createBoundsCheckingPass());
   PM.add(createBoundsCheckingPass());
 }
 }
+#endif // MS_ENABLE_OBJCARC // HLSL Change
 
 
 #ifdef MS_ENABLE_INSTR // HLSL Change
 #ifdef MS_ENABLE_INSTR // HLSL Change
 
 

+ 3 - 1
tools/clang/lib/CodeGen/CodeGenModule.cpp

@@ -183,10 +183,12 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
 }
 }
 
 
 CodeGenModule::~CodeGenModule() {
 CodeGenModule::~CodeGenModule() {
+#if 0 // HLSL Change - no ObjC, OpenCL, OpenMP, or CUDA support
   delete ObjCRuntime;
   delete ObjCRuntime;
   delete OpenCLRuntime;
   delete OpenCLRuntime;
   delete OpenMPRuntime;
   delete OpenMPRuntime;
   delete CUDARuntime;
   delete CUDARuntime;
+#endif // HLSL Change
   delete HLSLRuntime;  // HLSL Change
   delete HLSLRuntime;  // HLSL Change
   TheTargetCodeGenInfo.reset(nullptr); // HLSL Change
   TheTargetCodeGenInfo.reset(nullptr); // HLSL Change
   delete TBAA;
   delete TBAA;
@@ -3252,7 +3254,7 @@ void CodeGenModule::EmitObjCPropertyImplementations(const
                                  const_cast<ObjCImplementationDecl *>(D), PID);
                                  const_cast<ObjCImplementationDecl *>(D), PID);
     }
     }
   }
   }
-#endif 0 // HLSL Change - no ObjC support
+#endif // HLSL Change - no ObjC support
 }
 }
 
 
 static bool needsDestructMethod(ObjCImplementationDecl *impl) {
 static bool needsDestructMethod(ObjCImplementationDecl *impl) {