[cfe-commits] r147448 - in /cfe/trunk: include/clang/Basic/LangOptions.def include/clang/Frontend/PreprocessorOptions.h include/clang/Lex/Preprocessor.h lib/Frontend/CompilerInvocation.cpp lib/Frontend/InitPreprocessor.cpp lib/Lex/PPDirectives.cpp lib/Lex/Preprocessor.cpp
Douglas Gregor
dgregor at apple.com
Tue Jan 3 09:07:34 PST 2012
Author: dgregor
Date: Tue Jan 3 11:07:34 2012
New Revision: 147448
URL: http://llvm.org/viewvc/llvm-project?rev=147448&view=rev
Log:
Add a "Modules" language option, which subsumes the previous
"AutoModuleImport" preprocessor option and is tied to -fmodules.
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Frontend/PreprocessorOptions.h
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Jan 3 11:07:34 2012
@@ -90,7 +90,7 @@
BENIGN_LANGOPT(EmitAllDecls , 1, 0, "support for emitting all declarations")
LANGOPT(MathErrno , 1, 1, "errno support for math functions")
BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't like and may be ripped out at any time")
-
+LANGOPT(Modules , 1, 0, "modules extension to C")
LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro")
LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro")
LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)")
Modified: cfe/trunk/include/clang/Frontend/PreprocessorOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PreprocessorOptions.h?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PreprocessorOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/PreprocessorOptions.h Tue Jan 3 11:07:34 2012
@@ -50,10 +50,6 @@
/// record of all macro definitions and
/// expansions.
- /// \brief Whether we should automatically translate #include or #import
- /// operations into module imports when possible.
- unsigned AutoModuleImport : 1;
-
/// \brief Whether the detailed preprocessing record includes nested macro
/// expansions.
unsigned DetailedRecordIncludesNestedMacroExpansions : 1;
@@ -166,7 +162,6 @@
public:
PreprocessorOptions() : UsePredefines(true), DetailedRecord(false),
- AutoModuleImport(false),
DetailedRecordIncludesNestedMacroExpansions(true),
DisablePCHValidation(false), DisableStatCache(false),
DumpDeserializedPCHDecls(false),
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Jan 3 11:07:34 2012
@@ -107,7 +107,6 @@
bool KeepComments : 1;
bool KeepMacroComments : 1;
bool SuppressIncludeNotFoundError : 1;
- bool AutoModuleImport : 1;
// State that changes while the preprocessor runs:
bool InMacroArgs : 1; // True if parsing fn macro invocation args.
@@ -397,11 +396,6 @@
return SuppressIncludeNotFoundError;
}
- /// \brief Specify whether automatic module imports are enabled.
- void setAutoModuleImport(bool AutoModuleImport = true) {
- this->AutoModuleImport = AutoModuleImport;
- }
-
/// isCurrentLexer - Return true if we are lexing directly from the specified
/// lexer.
bool isCurrentLexer(const PreprocessorLexer *L) const {
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Jan 3 11:07:34 2012
@@ -716,6 +716,8 @@
Res.push_back("-fblocks");
if (Opts.BlocksRuntimeOptional)
Res.push_back("-fblocks-runtime-optional");
+ if (Opts.Modules)
+ Res.push_back("-fmodules");
if (Opts.EmitAllDecls)
Res.push_back("-femit-all-decls");
if (Opts.MathErrno)
@@ -1814,6 +1816,7 @@
Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
Opts.Blocks = Args.hasArg(OPT_fblocks);
Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
+ Opts.Modules = Args.hasArg(OPT_fmodules);
Opts.CharIsSigned = !Args.hasArg(OPT_fno_signed_char);
Opts.ShortWChar = Args.hasArg(OPT_fshort_wchar);
Opts.ShortEnums = Args.hasArg(OPT_fshort_enums);
@@ -1903,7 +1906,6 @@
Opts.TokenCache = Opts.ImplicitPTHInclude;
Opts.UsePredefines = !Args.hasArg(OPT_undef);
Opts.DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record);
- Opts.AutoModuleImport = Args.hasArg(OPT_fmodules);
Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch);
Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls);
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Jan 3 11:07:34 2012
@@ -627,10 +627,6 @@
InitializeFileRemapping(PP.getDiagnostics(), PP.getSourceManager(),
PP.getFileManager(), InitOpts);
- // Specify whether the preprocessor should replace #include/#import with
- // module imports when plausible.
- PP.setAutoModuleImport(InitOpts.AutoModuleImport);
-
// Emit line markers for various builtin sections of the file. We don't do
// this in asm preprocessor mode, because "# 4" is not a line marker directive
// in this mode.
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Jan 3 11:07:34 2012
@@ -1294,7 +1294,7 @@
const FileEntry *File = LookupFile(
Filename, isAngled, LookupFrom, CurDir,
Callbacks ? &SearchPath : NULL, Callbacks ? &RelativePath : NULL,
- AutoModuleImport? &SuggestedModule : 0);
+ getLangOptions().Modules? &SuggestedModule : 0);
if (Callbacks) {
if (!File) {
@@ -1308,7 +1308,7 @@
// Try the lookup again, skipping the cache.
File = LookupFile(Filename, isAngled, LookupFrom, CurDir, 0, 0,
- AutoModuleImport ? &SuggestedModule : 0,
+ getLangOptions().Modules? &SuggestedModule : 0,
/*SkipCache*/true);
}
}
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=147448&r1=147447&r2=147448&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Tue Jan 3 11:07:34 2012
@@ -130,7 +130,6 @@
KeepComments = false;
KeepMacroComments = false;
SuppressIncludeNotFoundError = false;
- AutoModuleImport = false;
// Macro expansion is enabled.
DisableMacroExpansion = false;
More information about the cfe-commits
mailing list