// -fpascal-strings
static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
TargetInfo *Target) {
+ // Allow the target to set the default the langauge options as it sees fit.
+ Target->getDefaultLangOptions(Options);
if (Ansi) // "The -ansi option is equivalent to -std=c89."
LangStd = lang_c89;
Options.LaxVectorConversions = LaxVectorConversions;
Options.Exceptions = Exceptions;
- if (NeXTRuntime) {
+ // Override the default runtime if the user requested it.
+ if (NeXTRuntime)
Options.NeXTRuntime = 1;
- } else if (GNURuntime) {
+ else if (GNURuntime)
Options.NeXTRuntime = 0;
- } else {
- Options.NeXTRuntime = Target->useNeXTRuntimeAsDefault();
- }
}
static llvm::cl::opt<bool>
InitializeBaseLanguage();
LangKind LK = GetLanguage(InFile);
bool PCH = InitializeLangOptions(LangInfo, LK);
- InitializeLanguageStandard(LangInfo, LK, Target.get());
InitializeGCMode(LangInfo);
+ InitializeLanguageStandard(LangInfo, LK, Target.get());
// Process the -I options and set them in the HeaderInfo.
HeaderSearch HeaderInfo(FileMgr);
class Diagnostic;
class SourceManager;
+class LangOptions;
namespace Builtin { struct Info; }
virtual bool useGlobalsForAutomaticVariables() const { return false; }
- virtual bool useNeXTRuntimeAsDefault() const { return false; }
+ /// getDefaultLangOptions - Allow the target to specify default settings for
+ /// various language options. These may be overridden by command line
+ /// options.
+ virtual void getDefaultLangOptions(LangOptions &Opts) {}
protected:
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
#include "clang/AST/Builtins.h"
#include "clang/AST/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/LangOptions.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/APFloat.h"
using namespace clang;
getDarwinDefines(Defines, getTargetTriple());
}
- virtual bool useNeXTRuntimeAsDefault() const { return true; }
+ /// getDefaultLangOptions - Allow the target to specify default settings for
+ /// various language options. These may be overridden by command line
+ /// options.
+ virtual void getDefaultLangOptions(LangOptions &Opts) {
+ Opts.NeXTRuntime = true;
+ }
};
} // end anonymous namespace.
getDarwinDefines(Defines, getTargetTriple());
}
- virtual bool useNeXTRuntimeAsDefault() const { return true; }
+ /// getDefaultLangOptions - Allow the target to specify default settings for
+ /// various language options. These may be overridden by command line
+ /// options.
+ virtual void getDefaultLangOptions(LangOptions &Opts) {
+ Opts.NeXTRuntime = true;
+ }
};
} // end anonymous namespace.
X86_32TargetInfo::getTargetDefines(Defines);
getDarwinDefines(Defines, getTargetTriple());
}
- virtual bool useNeXTRuntimeAsDefault() const { return true; }
+ /// getDefaultLangOptions - Allow the target to specify default settings for
+ /// various language options. These may be overridden by command line
+ /// options.
+ virtual void getDefaultLangOptions(LangOptions &Opts) {
+ Opts.NeXTRuntime = true;
+ }
};
} // end anonymous namespace
getDarwinDefines(Defines, getTargetTriple());
}
- virtual bool useNeXTRuntimeAsDefault() const { return true; }
+ /// getDefaultLangOptions - Allow the target to specify default settings for
+ /// various language options. These may be overridden by command line
+ /// options.
+ virtual void getDefaultLangOptions(LangOptions &Opts) {
+ Opts.NeXTRuntime = true;
+ }
};
} // end anonymous namespace.