[clang][cli] NFC: Add PIE parsing for precompiled input and IR
authorJan Svoboda <jan_svoboda@apple.com>
Fri, 15 Jan 2021 14:42:29 +0000 (15:42 +0100)
committerJan Svoboda <jan_svoboda@apple.com>
Fri, 15 Jan 2021 15:41:34 +0000 (16:41 +0100)
This patch effectively reverts a small part of D83979.

When we stop parsing `LangOpts` unconditionally in `parseSimpleArgs` (above the diff) and move them back to `ParseLangArgs` (called in `else` branch) in D94682, `LangOpts.PIE` would never get parsed in this `if` branch. This patch ensures this doesn't happen.

Right now, this causes `LangOpts.PIE` to be parsed twice, but that will be immediately corrected in D94682.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D94679

clang/lib/Frontend/CompilerInvocation.cpp

index c85b0f9..d261eb7 100644 (file)
@@ -2970,6 +2970,7 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
     // PIClevel and PIELevel are needed during code generation and this should be
     // set regardless of the input type.
     LangOpts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
+    LangOpts.PIE = Args.hasArg(OPT_pic_is_pie);
     parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
                         Diags, LangOpts.Sanitize);
   } else {