// on making enums signed. Set/Query this
// value using accessors.
- /// The user provided name for the "main file", if non-null. This is
- /// useful in situations where the input file name does not match
- /// the original input file, for example with -save-temps.
- const char *MainFileName;
-
public:
unsigned InstantiationDepth; // Maximum template instantiation depth.
CharIsSigned = 1;
ShortWChar = 0;
-
- MainFileName = 0;
}
GCMode getGCMode() const { return (GCMode) GC; }
StackProtector = static_cast<unsigned>(m);
}
- const char *getMainFileName() const { return MainFileName; }
- void setMainFileName(const char *Name) { MainFileName = Name; }
-
VisibilityMode getVisibilityMode() const {
return (VisibilityMode) SymbolVisibility;
}
/// Inlining - The kind of inlining to perform.
InliningMethod Inlining;
+ /// The user provided name for the "main file", if non-empty. This is useful
+ /// in situations where the input file name does not match the original input
+ /// file, for example with -save-temps.
+ std::string MainFileName;
+
public:
CodeGenOptions() {
OptimizationLevel = 0;
// file at a time.
bool isMain = false;
const LangOptions &LO = M->getLangOptions();
- const char *MainFileName = LO.getMainFileName();
+ const CodeGenOptions &CGO = M->getCodeGenOpts();
if (isMainCompileUnitCreated == false) {
- if (MainFileName) {
- if (!strcmp(AbsFileName.getLast().c_str(), MainFileName))
+ if (!CGO.MainFileName.empty()) {
+ if (AbsFileName.getLast() == CGO.MainFileName)
isMain = true;
} else {
if (Loc.isValid() && SM.isFromMainFile(Loc))
Opts.SimplifyLibCalls = 1;
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize);
+ Opts.MainFileName = getLastArgValue(Args, OPT_main_file_name);
+
// FIXME: Implement!
// FIXME: Eliminate this dependency?
// if (Lang.NoBuiltin)
Res.push_back("-Os");
} else if (Opts.OptimizationLevel != 0)
Res.push_back("-O" + llvm::utostr(Opts.OptimizationLevel));
+ if (!Opts.MainFileName.empty()) {
+ Res.push_back("-main-file-name");
+ Res.push_back(Opts.MainFileName);
+ }
// SimplifyLibCalls is only derived.
// TimePasses is only derived.
// UnitAtATime is unused.
Res.push_back("-stack-protector");
Res.push_back(llvm::utostr(Opts.getStackProtectorMode()));
}
- if (Opts.getMainFileName()) {
- Res.push_back("-main-file-name");
- Res.push_back(Opts.getMainFileName());
- }
if (Opts.InstantiationDepth != DefaultLangOpts.InstantiationDepth) {
Res.push_back("-ftemplate-depth");
Res.push_back(llvm::utostr(Opts.InstantiationDepth));
GenerateDebugInfo("g",
llvm::cl::desc("Generate source level debug information"));
+static llvm::cl::opt<std::string>
+MainFileName("main-file-name",
+ llvm::cl::desc("Main file name to use for debug info"));
+
static llvm::cl::opt<bool>
NoCommon("fno-common",
llvm::cl::desc("Compile common globals like normal definitions"),
llvm::cl::desc("Accept some non-standard constructs used in "
"Microsoft header files "));
-static llvm::cl::opt<std::string>
-MainFileName("main-file-name",
- llvm::cl::desc("Main file name to use for debug info"));
-
static llvm::cl::opt<bool>
NoMathErrno("fno-math-errno",
llvm::cl::desc("Don't require math functions to respect errno"));
#ifdef NDEBUG
Opts.VerifyModule = 0;
#endif
+
+ if (MainFileName.getPosition())
+ Opts.MainFileName = MainFileName;
}
void clang::InitializeDependencyOutputOptions(DependencyOutputOptions &Opts) {
Options.LaxVectorConversions = 1;
}
- if (ObjCExclusiveGC)
- Options.setGCMode(LangOptions::GCOnly);
- else if (ObjCEnableGC)
- Options.setGCMode(LangOptions::HybridGC);
-
- if (ObjCEnableGCBitmapPrint)
- Options.ObjCGCBitmapPrint = 1;
-
- if (AltiVec)
- Options.AltiVec = 1;
-
- if (PThread)
- Options.POSIXThreads = 1;
-
- Options.setVisibilityMode(SymbolVisibility);
- Options.OverflowChecking = OverflowChecking;
-
if (LangStd == LangStandard::lang_unspecified) {
// Based on the base language, pick one.
switch (IK) {
if (Options.CPlusPlus)
Options.CXXOperatorNames = !NoOperatorNames;
+ if (ObjCExclusiveGC)
+ Options.setGCMode(LangOptions::GCOnly);
+ else if (ObjCEnableGC)
+ Options.setGCMode(LangOptions::HybridGC);
+
+ if (ObjCEnableGCBitmapPrint)
+ Options.ObjCGCBitmapPrint = 1;
+
+ if (AltiVec)
+ Options.AltiVec = 1;
+
+ if (PThread)
+ Options.POSIXThreads = 1;
+
+ Options.setVisibilityMode(SymbolVisibility);
+ Options.OverflowChecking = OverflowChecking;
+
// Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs
// is specified, or -std is set to a conforming mode.
Options.Trigraphs = !Options.GNUMode;
case 2: Options.setStackProtectorMode(LangOptions::SSPReq); break;
}
}
-
- if (MainFileName.getPosition())
- Options.setMainFileName(MainFileName.c_str());
}
void