[clang] 3832629 - [clang][cli] NFC: Add PIE parsing for precompiled input and IR

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 07:41:50 PST 2021


Author: Jan Svoboda
Date: 2021-01-15T16:41:34+01:00
New Revision: 383262933045e1c138362105be4ee4d1b62ab4cc

URL: https://github.com/llvm/llvm-project/commit/383262933045e1c138362105be4ee4d1b62ab4cc
DIFF: https://github.com/llvm/llvm-project/commit/383262933045e1c138362105be4ee4d1b62ab4cc.diff

LOG: [clang][cli] NFC: Add PIE parsing for precompiled input and IR

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

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index c85b0f9d65cf..d261eb7f45cd 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -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 {


        


More information about the cfe-commits mailing list