[llvm] r178713 - Make it possible to include llvm-c without including C++ headers. Patch by Filip Pizlo.
Evan Cheng
evan.cheng at apple.com
Wed Apr 3 16:12:39 PDT 2013
Author: evancheng
Date: Wed Apr 3 18:12:39 2013
New Revision: 178713
URL: http://llvm.org/viewvc/llvm-project?rev=178713&view=rev
Log:
Make it possible to include llvm-c without including C++ headers. Patch by Filip Pizlo.
Modified:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/include/llvm-c/ExecutionEngine.h
llvm/trunk/include/llvm-c/Object.h
llvm/trunk/include/llvm-c/Target.h
llvm/trunk/include/llvm-c/TargetMachine.h
llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=178713&r1=178712&r2=178713&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Wed Apr 3 18:12:39 2013
@@ -17,14 +17,15 @@
#include "llvm/Support/DataTypes.h"
-#ifdef __cplusplus
-
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
/* Need these includes to support the LLVM 'cast' template for the C++ 'wrap'
and 'unwrap' conversion functions. */
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/PassRegistry.h"
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
+#ifdef __cplusplus
extern "C" {
#endif
@@ -2669,7 +2670,9 @@ LLVMBool LLVMIsMultithreaded();
#ifdef __cplusplus
}
+#endif
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
namespace llvm {
class MemoryBuffer;
class PassManagerBase;
@@ -2763,6 +2766,6 @@ namespace llvm {
}
}
-#endif /* !defined(__cplusplus) */
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
-#endif /* !defined(LLVM_C_CORE_H) */
+#endif /* defined(LLVM_C_CORE_H) */
Modified: llvm/trunk/include/llvm-c/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=178713&r1=178712&r2=178713&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm-c/ExecutionEngine.h Wed Apr 3 18:12:39 2013
@@ -138,7 +138,9 @@ void *LLVMGetPointerToGlobal(LLVMExecuti
#ifdef __cplusplus
}
+#endif
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
namespace llvm {
struct GenericValue;
class ExecutionEngine;
@@ -157,7 +159,6 @@ namespace llvm {
#undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS
}
-
-#endif /* defined(__cplusplus) */
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
#endif
Modified: llvm/trunk/include/llvm-c/Object.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Object.h?rev=178713&r1=178712&r2=178713&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Object.h (original)
+++ llvm/trunk/include/llvm-c/Object.h Wed Apr 3 18:12:39 2013
@@ -22,9 +22,11 @@
#include "llvm-c/Core.h"
#include "llvm/Config/llvm-config.h"
-#ifdef __cplusplus
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
#include "llvm/Object/ObjectFile.h"
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
+#ifdef __cplusplus
extern "C" {
#endif
@@ -99,7 +101,9 @@ const char *LLVMGetRelocationValueString
#ifdef __cplusplus
}
+#endif
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
namespace llvm {
namespace object {
inline ObjectFile *unwrap(LLVMObjectFileRef OF) {
@@ -142,8 +146,8 @@ namespace llvm {
}
}
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
-#endif /* defined(__cplusplus) */
#endif
Modified: llvm/trunk/include/llvm-c/Target.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=178713&r1=178712&r2=178713&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Target.h (original)
+++ llvm/trunk/include/llvm-c/Target.h Wed Apr 3 18:12:39 2013
@@ -235,7 +235,9 @@ void LLVMDisposeTargetData(LLVMTargetDat
#ifdef __cplusplus
}
+#endif
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
namespace llvm {
class DataLayout;
class TargetLibraryInfo;
@@ -257,7 +259,6 @@ namespace llvm {
return reinterpret_cast<LLVMTargetLibraryInfoRef>(X);
}
}
-
-#endif /* defined(__cplusplus) */
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
#endif
Modified: llvm/trunk/include/llvm-c/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/TargetMachine.h?rev=178713&r1=178712&r2=178713&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/TargetMachine.h (original)
+++ llvm/trunk/include/llvm-c/TargetMachine.h Wed Apr 3 18:12:39 2013
@@ -119,7 +119,9 @@ LLVMBool LLVMTargetMachineEmitToFile(LLV
#ifdef __cplusplus
}
+#endif
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
namespace llvm {
class TargetMachine;
class Target;
@@ -138,6 +140,6 @@ namespace llvm {
return reinterpret_cast<LLVMTargetRef>(const_cast<Target*>(P));
}
}
-#endif
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
#endif
Modified: llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h?rev=178713&r1=178712&r2=178713&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h (original)
+++ llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h Wed Apr 3 18:12:39 2013
@@ -18,8 +18,11 @@
typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;
-#ifdef __cplusplus
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
+#endif
+
+#ifdef __cplusplus
extern "C" {
#endif
@@ -86,7 +89,9 @@ void LLVMPassManagerBuilderPopulateLTOPa
#ifdef __cplusplus
}
+#endif
+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)
namespace llvm {
inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {
return reinterpret_cast<PassManagerBuilder*>(P);
@@ -96,6 +101,6 @@ namespace llvm {
return reinterpret_cast<LLVMPassManagerBuilderRef>(P);
}
}
-#endif
+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */
#endif
More information about the llvm-commits
mailing list