r209503 - Fix '-main-file-name <name>' so that it is used for the ModuleID.

Warren Hunt whunt at google.com
Wed May 28 11:45:22 PDT 2014


This commit breaks functionality because asan uses the ModuleID when
checking blacklists.  We're going to need to fix it and/or revert it.

-Warren


On Fri, May 23, 2014 at 12:34 AM, Robert Lytton <robert at xmos.com> wrote:

> Author: rlytton
> Date: Fri May 23 02:34:08 2014
> New Revision: 209503
>
> URL: http://llvm.org/viewvc/llvm-project?rev=209503&view=rev
> Log:
> Fix '-main-file-name <name>' so that it is used for the ModuleID.
>
> Summary:
> Previously, you could not specify the original file name when passing a
> preprocessed file into the compiler
> Now you can use 'clang -Xclang -main-file-name -Xclang <original file
> name> ...'
> Or 'clang -cc1 -main-file-name <original file name> ...'
>
> Added:
>     cfe/trunk/test/CodeGen/main-file-name.c
> Modified:
>     cfe/trunk/lib/CodeGen/CodeGenAction.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=209503&r1=209502&r2=209503&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Fri May 23 02:34:08 2014
> @@ -551,9 +551,12 @@ ASTConsumer *CodeGenAction::CreateASTCon
>      LinkModuleToUse = ModuleOrErr.get();
>    }
>
> +  StringRef MainFileName =
> getCompilerInstance().getCodeGenOpts().MainFileName;
> +  if (MainFileName.empty())
> +    MainFileName = InFile;
>    BEConsumer = new BackendConsumer(BA, CI.getDiagnostics(),
> CI.getCodeGenOpts(),
>                                     CI.getTargetOpts(), CI.getLangOpts(),
> -                                   CI.getFrontendOpts().ShowTimers,
> InFile,
> +                                   CI.getFrontendOpts().ShowTimers,
> MainFileName,
>                                     LinkModuleToUse, OS.release(),
> *VMContext);
>    return BEConsumer;
>  }
>
> Added: cfe/trunk/test/CodeGen/main-file-name.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/main-file-name.c?rev=209503&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGen/main-file-name.c (added)
> +++ cfe/trunk/test/CodeGen/main-file-name.c Fri May 23 02:34:08 2014
> @@ -0,0 +1,6 @@
> +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
> +// RUN: %clang_cc1 -emit-llvm -o - %s -main-file-name some.name |
> FileCheck -check-prefix NAMED %s
> +
> +// CHECK: ; ModuleID = '{{.*}}main-file-name.c'
> +// NAMED: ; ModuleID = 'some.name'
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140528/80e387de/attachment.html>


More information about the cfe-commits mailing list