[cfe-commits] r166868 - in /cfe/trunk: include/clang/Basic/LangOptions.def include/clang/Driver/Options.td lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/Driver/clang_fopenmp_opt.c
Mahesha S
mahesha.llvm at gmail.com
Sat Oct 27 00:47:56 PDT 2012
Author: mahesha
Date: Sat Oct 27 02:47:56 2012
New Revision: 166868
URL: http://llvm.org/viewvc/llvm-project?rev=166868&view=rev
Log:
-------------------------------------------------
Feature:
OpenMP support in CLANG:
Sub-Feature:
Support for option -fopenmp
Files Changed/Added:
* include/clang/Driver/Options.td (C)
* include/clang/Basic/LangOptions.def (C)
* lib/Driver/Tools.cpp (C)
* lib/Frontend/CompilerInvocation.cpp (C)
Test Cases Changed/Added:
* test/Driver/clang_fopenmp_opt.c (A)
-------------------------------------------------
Added:
cfe/trunk/test/Driver/clang_fopenmp_opt.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=166868&r1=166867&r2=166868&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Sat Oct 27 02:47:56 2012
@@ -167,6 +167,8 @@
BENIGN_LANGOPT(EmitMicrosoftInlineAsm , 1, 0,
"Enable emission of MS-style inline assembly.")
+LANGOPT(OpenMP, 1, 0, "Enables OpenMP support.")
+
BENIGN_LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST")
#undef LANGOPT
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=166868&r1=166867&r2=166868&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Sat Oct 27 02:47:56 2012
@@ -594,7 +594,7 @@
def fobjc_sender_dependent_dispatch : Flag<["-"], "fobjc-sender-dependent-dispatch">, Group<f_Group>;
def fobjc : Flag<["-"], "fobjc">, Group<f_Group>;
def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, Group<f_Group>;
-def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>;
+def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>, Flags<[CC1Option]>;
def fno_optimize_sibling_calls : Flag<["-"], "fno-optimize-sibling-calls">, Group<f_Group>;
def foptimize_sibling_calls : Flag<["-"], "foptimize-sibling-calls">, Group<f_Group>;
def force__cpusubtype__ALL : Flag<["-"], "force_cpusubtype_ALL">;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=166868&r1=166867&r2=166868&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Oct 27 02:47:56 2012
@@ -2412,6 +2412,8 @@
Args.AddLastArg(CmdArgs, options::OPT_pthread);
+ Args.AddLastArg(CmdArgs, options::OPT_fopenmp);
+
// -stack-protector=0 is default.
unsigned StackProtectorLevel = 0;
if (Arg *A = Args.getLastArg(options::OPT_fno_stack_protector,
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=166868&r1=166867&r2=166868&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Oct 27 02:47:56 2012
@@ -870,6 +870,8 @@
Res.push_back("-fapple-pragma-pack");
if (!Opts.CurrentModule.empty())
Res.push_back("-fmodule-name=" + Opts.CurrentModule);
+ if (Opts.OpenMP)
+ Res.push_back("-fopenmp");
}
static void PreprocessorOptsToArgs(const PreprocessorOptions &Opts,
@@ -2143,6 +2145,7 @@
Opts.ThreadSanitizer = Args.hasArg(OPT_fthread_sanitizer);
Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
+ Opts.OpenMP = Args.hasArg(OPT_fopenmp);
// Record whether the __DEPRECATED define was requested.
Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
Added: cfe/trunk/test/Driver/clang_fopenmp_opt.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_fopenmp_opt.c?rev=166868&view=auto
==============================================================================
--- cfe/trunk/test/Driver/clang_fopenmp_opt.c (added)
+++ cfe/trunk/test/Driver/clang_fopenmp_opt.c Sat Oct 27 02:47:56 2012
@@ -0,0 +1,2 @@
+// RUN: %clang -### -S -o %t %s 2>&1 | not grep -w -- -fopenmp
+// RUN: %clang -### -S -o %t %s -fopenmp 2>&1 | grep -w -- -fopenmp
More information about the cfe-commits
mailing list