summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Basic/Targets.cpp24
-rw-r--r--clang/lib/Basic/Targets.h4
-rw-r--r--clang/lib/Basic/Targets/X86.h24
3 files changed, 28 insertions, 24 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index e67ffdbf119..9946f82405e 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -73,6 +73,30 @@ void defineCPUMacros(MacroBuilder &Builder, StringRef CPUName, bool Tuning) {
Builder.defineMacro("__tune_" + CPUName + "__");
}
+void addCygMingDefines(const LangOptions &Opts, MacroBuilder &Builder) {
+ // Mingw and cygwin define __declspec(a) to __attribute__((a)). Clang
+ // supports __declspec natively under -fms-extensions, but we define a no-op
+ // __declspec macro anyway for pre-processor compatibility.
+ if (Opts.MicrosoftExt)
+ Builder.defineMacro("__declspec", "__declspec");
+ else
+ Builder.defineMacro("__declspec(a)", "__attribute__((a))");
+
+ if (!Opts.MicrosoftExt) {
+ // Provide macros for all the calling convention keywords. Provide both
+ // single and double underscore prefixed variants. These are available on
+ // x64 as well as x86, even though they have no effect.
+ const char *CCs[] = {"cdecl", "stdcall", "fastcall", "thiscall", "pascal"};
+ for (const char *CC : CCs) {
+ std::string GCCSpelling = "__attribute__((__";
+ GCCSpelling += CC;
+ GCCSpelling += "__))";
+ Builder.defineMacro(Twine("_") + CC, GCCSpelling);
+ Builder.defineMacro(Twine("__") + CC, GCCSpelling);
+ }
+ }
+}
+
void addMinGWDefines(const LangOptions &Opts, MacroBuilder &Builder) {
Builder.defineMacro("__MSVCRT__");
Builder.defineMacro("__MINGW32__");
diff --git a/clang/lib/Basic/Targets.h b/clang/lib/Basic/Targets.h
index 13ed203534f..12a23fa8142 100644
--- a/clang/lib/Basic/Targets.h
+++ b/clang/lib/Basic/Targets.h
@@ -42,6 +42,10 @@ void defineCPUMacros(clang::MacroBuilder &Builder, llvm::StringRef CPUName,
LLVM_LIBRARY_VISIBILITY
void addMinGWDefines(const clang::LangOptions &Opts,
clang::MacroBuilder &Builder);
+
+LLVM_LIBRARY_VISIBILITY
+void addCygMingDefines(const clang::LangOptions &Opts,
+ clang::MacroBuilder &Builder);
} // namespace targets
} // namespace clang
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_H
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index e41a042001a..938c3d6eef5 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -691,30 +691,6 @@ public:
}
};
-static void addCygMingDefines(const LangOptions &Opts, MacroBuilder &Builder) {
- // Mingw and cygwin define __declspec(a) to __attribute__((a)). Clang
- // supports __declspec natively under -fms-extensions, but we define a no-op
- // __declspec macro anyway for pre-processor compatibility.
- if (Opts.MicrosoftExt)
- Builder.defineMacro("__declspec", "__declspec");
- else
- Builder.defineMacro("__declspec(a)", "__attribute__((a))");
-
- if (!Opts.MicrosoftExt) {
- // Provide macros for all the calling convention keywords. Provide both
- // single and double underscore prefixed variants. These are available on
- // x64 as well as x86, even though they have no effect.
- const char *CCs[] = {"cdecl", "stdcall", "fastcall", "thiscall", "pascal"};
- for (const char *CC : CCs) {
- std::string GCCSpelling = "__attribute__((__";
- GCCSpelling += CC;
- GCCSpelling += "__))";
- Builder.defineMacro(Twine("_") + CC, GCCSpelling);
- Builder.defineMacro(Twine("__") + CC, GCCSpelling);
- }
- }
-}
-
// x86-32 MinGW target
class LLVM_LIBRARY_VISIBILITY MinGWX86_32TargetInfo
: public WindowsX86_32TargetInfo {
OpenPOWER on IntegriCloud