diff options
author | Evan Cheng <evan.cheng@apple.com> | 2013-04-03 23:12:39 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2013-04-03 23:12:39 +0000 |
commit | 51a7a9d712dce44179fa09d15d1cbda9f09fa227 (patch) | |
tree | 5249102f7f46c0ae6407d28084086b8d396de2ee /llvm/include/llvm-c | |
parent | c2d5bf5c53b0e4f29bfa75416d3b0a6fe54a9a44 (diff) | |
download | bcm5719-llvm-51a7a9d712dce44179fa09d15d1cbda9f09fa227.tar.gz bcm5719-llvm-51a7a9d712dce44179fa09d15d1cbda9f09fa227.zip |
Make it possible to include llvm-c without including C++ headers. Patch by Filip Pizlo.
llvm-svn: 178713
Diffstat (limited to 'llvm/include/llvm-c')
-rw-r--r-- | llvm/include/llvm-c/Core.h | 11 | ||||
-rw-r--r-- | llvm/include/llvm-c/ExecutionEngine.h | 5 | ||||
-rw-r--r-- | llvm/include/llvm-c/Object.h | 8 | ||||
-rw-r--r-- | llvm/include/llvm-c/Target.h | 5 | ||||
-rw-r--r-- | llvm/include/llvm-c/TargetMachine.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm-c/Transforms/PassManagerBuilder.h | 9 |
6 files changed, 29 insertions, 13 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index e85fb975050..cc78b2e6fd2 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -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) */ diff --git a/llvm/include/llvm-c/ExecutionEngine.h b/llvm/include/llvm-c/ExecutionEngine.h index cb77bb2e2e2..6ca316c2b1b 100644 --- a/llvm/include/llvm-c/ExecutionEngine.h +++ b/llvm/include/llvm-c/ExecutionEngine.h @@ -138,7 +138,9 @@ void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global); #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 diff --git a/llvm/include/llvm-c/Object.h b/llvm/include/llvm-c/Object.h index e2dad62b4e0..b6fe17a159f 100644 --- a/llvm/include/llvm-c/Object.h +++ b/llvm/include/llvm-c/Object.h @@ -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(LLVMRelocationIteratorRef RI); #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 diff --git a/llvm/include/llvm-c/Target.h b/llvm/include/llvm-c/Target.h index 57abfa0207f..0327c04f177 100644 --- a/llvm/include/llvm-c/Target.h +++ b/llvm/include/llvm-c/Target.h @@ -235,7 +235,9 @@ void LLVMDisposeTargetData(LLVMTargetDataRef); #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 diff --git a/llvm/include/llvm-c/TargetMachine.h b/llvm/include/llvm-c/TargetMachine.h index 691abdfcb47..e6f477af787 100644 --- a/llvm/include/llvm-c/TargetMachine.h +++ b/llvm/include/llvm-c/TargetMachine.h @@ -119,7 +119,9 @@ LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M, #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 diff --git a/llvm/include/llvm-c/Transforms/PassManagerBuilder.h b/llvm/include/llvm-c/Transforms/PassManagerBuilder.h index 82e513d4905..b39dd243991 100644 --- a/llvm/include/llvm-c/Transforms/PassManagerBuilder.h +++ b/llvm/include/llvm-c/Transforms/PassManagerBuilder.h @@ -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 LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB, #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 |