def CXX0xStaticNonIntegralInitializer :
DiagGroup<"c++0x-static-nonintegral-init">;
def CXX0x : DiagGroup<"c++0x-extensions", [CXX0xStaticNonIntegralInitializer]>;
+def DelegatingCtorCycles :
+ DiagGroup<"delegating-ctor-cycles">;
// A warning group for warnings about GCC extensions.
def GNU : DiagGroup<"gnu", [GNUDesignator, VLA]>;
// C++0x delegating constructors
def err_delegation_0x_only : Error<
"delegating constructors are permitted only in C++0x">;
-def err_delegation_unimplemented : Error<
- "delegating constructors are not fully implemented">;
def err_delegating_initializer_alone : Error<
"an initializer for a delegating constructor must appear alone">;
-def err_delegating_ctor_cycle : Error<
- "constructor for %0 creates a delegation cycle">;
+def warn_delegating_ctor_cycle : Warning<
+ "constructor for %0 creates a delegation cycle">, DefaultError,
+ InGroup<DelegatingCtorCycles>;
def note_it_delegates_to : Note<
- "it delegates to">;
+ "it delegates to">, InGroup<DelegatingCtorCycles>;
def note_which_delegates_to : Note<
- "which delegates to">;
+ "which delegates to">, InGroup<DelegatingCtorCycles>;
def err_delegating_codegen_not_implemented : Error<
"code generation for delegating constructors not implemented">;
unsigned MRTD : 1; // -mrtd calling convention
unsigned DelayedTemplateParsing : 1; // Delayed template parsing
- // Do we try to detect cycles in delegating constructors?
- unsigned CheckDelegatingCtorCycles : 1;
-
private:
// We declare multibit enums as unsigned because MSVC insists on making enums
// signed. Set/Query these values using accessors.
MRTD = 0;
DelayedTemplateParsing = 0;
ParseUnknownAnytype = 0;
-
- CheckDelegatingCtorCycles = 1;
}
GCMode getGCMode() const { return (GCMode) GC; }
HelpText<"Defines the __DEPRECATED macro">;
def fno_deprecated_macro : Flag<"-fno-deprecated-macro">,
HelpText<"Undefines the __DEPRECATED macro">;
-def fno_check_delegating_ctor_cycles : Flag<"-fno-check-delegating-ctor-cycles">,
- HelpText<"Turns off delegating constructor cycle detection">;
//===----------------------------------------------------------------------===//
// Header Search Options
Res.push_back("-fdelayed-template-parsing");
if (Opts.Deprecated)
Res.push_back("-fdeprecated-macro");
-
- if (Opts.CheckDelegatingCtorCycles)
- Res.push_back("-fcheck-delegating-ctor-cycles");
}
static void PreprocessorOptsToArgs(const PreprocessorOptions &Opts,
Opts.MRTD = Args.hasArg(OPT_mrtd);
Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
- Opts.CheckDelegatingCtorCycles
- = !Args.hasArg(OPT_fno_check_delegating_ctor_cycles);
// Record whether the __DEPRECATED define was requested.
Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
}
- if (LangOpts.CPlusPlus0x && LangOpts.CheckDelegatingCtorCycles)
+ if (LangOpts.CPlusPlus0x &&
+ Diags.getDiagnosticLevel(diag::warn_delegating_ctor_cycle,
+ SourceLocation())
+ != Diagnostic::Ignored)
CheckDelegatingCtorCycles();
// If there were errors, disable 'unused' warnings since they will mostly be
DiagnoseUseOfDecl(Dtor, Initializer->getSourceLocation());
}
- if (LangOpts.CheckDelegatingCtorCycles)
- DelegatingCtorDecls.push_back(Constructor);
+ DelegatingCtorDecls.push_back(Constructor);
return false;
}
// If we haven't diagnosed this cycle yet, do so now.
if (!Invalid.count(TCanonical)) {
S.Diag((*Ctor->init_begin())->getSourceLocation(),
- diag::err_delegating_ctor_cycle)
+ diag::warn_delegating_ctor_cycle)
<< Ctor;
// Don't add a note for a function delegating directo to itself.