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

Richard Smith richard at metafoo.co.uk
Thu May 22 18:18:55 PDT 2014


LGTM with tiny fixes.

================
Comment at: lib/CodeGen/CodeGenAction.cpp:554-557
@@ -553,3 +553,6 @@
 
+  StringRef mainFileName = getCompilerInstance().getCodeGenOpts().MainFileName;
+  if (mainFileName.empty())
+    mainFileName = InFile;
   BEConsumer = new BackendConsumer(BA, CI.getDiagnostics(), CI.getCodeGenOpts(),
                                    CI.getTargetOpts(), CI.getLangOpts(),
----------------
Per coding convention, this should be named `MainFileName`.

================
Comment at: test/Misc/main-file-name.c:1
@@ +1,2 @@
+// 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
----------------
This test should be in `tests/CodeGen`.

http://reviews.llvm.org/D3836






More information about the cfe-commits mailing list