summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp2
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 47234ef6492..521c90dc31e 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1015,6 +1015,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
II.getInputArg().renderAsInput(Args, CmdArgs);
}
+ Args.AddAllArgs(CmdArgs, options::OPT_undef);
+
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "clang-cc"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 2719fbb456c..ec5c1061bb9 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -443,7 +443,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
/// environment ready to process a single file. This returns true on error.
///
bool clang::InitializePreprocessor(Preprocessor &PP,
- const PreprocessorInitOptions &InitOpts) {
+ const PreprocessorInitOptions &InitOpts,
+ bool undef_macros) {
std::vector<char> PredefineBuffer;
const char *LineDirective = "# 1 \"<built-in>\" 3\n";
@@ -451,8 +452,9 @@ bool clang::InitializePreprocessor(Preprocessor &PP,
LineDirective, LineDirective+strlen(LineDirective));
// Install things like __POWERPC__, __GNUC__, etc into the macro table.
- InitializePredefinedMacros(PP.getTargetInfo(), PP.getLangOptions(),
- PredefineBuffer);
+ if (!undef_macros)
+ InitializePredefinedMacros(PP.getTargetInfo(), PP.getLangOptions(),
+ PredefineBuffer);
// Add on the predefines from the driver. Wrap in a #line directive to report
// that they come from the command line.
OpenPOWER on IntegriCloud