[cfe-commits] r130898 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/LangOptions.h include/clang/Driver/CC1Options.td lib/Frontend/CompilerInvocation.cpp lib/Sema/Sema.cpp lib/Sema/SemaDeclCXX.cpp
Sean Hunt
scshunt at csclub.uwaterloo.ca
Wed May 4 17:05:47 PDT 2011
Author: coppro
Date: Wed May 4 19:05:47 2011
New Revision: 130898
URL: http://llvm.org/viewvc/llvm-project?rev=130898&view=rev
Log:
Change cycle detection to be based off of a warning flag.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed May 4 19:05:47 2011
@@ -271,6 +271,8 @@
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]>;
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed May 4 19:05:47 2011
@@ -1009,16 +1009,15 @@
// 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">;
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Wed May 4 19:05:47 2011
@@ -134,9 +134,6 @@
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.
@@ -235,8 +232,6 @@
MRTD = 0;
DelayedTemplateParsing = 0;
ParseUnknownAnytype = 0;
-
- CheckDelegatingCtorCycles = 1;
}
GCMode getGCMode() const { return (GCMode) GC; }
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Wed May 4 19:05:47 2011
@@ -550,8 +550,6 @@
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
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed May 4 19:05:47 2011
@@ -698,9 +698,6 @@
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,
@@ -1569,8 +1566,6 @@
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,
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Wed May 4 19:05:47 2011
@@ -474,7 +474,10 @@
}
- 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
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=130898&r1=130897&r2=130898&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed May 4 19:05:47 2011
@@ -2085,8 +2085,7 @@
DiagnoseUseOfDecl(Dtor, Initializer->getSourceLocation());
}
- if (LangOpts.CheckDelegatingCtorCycles)
- DelegatingCtorDecls.push_back(Constructor);
+ DelegatingCtorDecls.push_back(Constructor);
return false;
}
@@ -7984,7 +7983,7 @@
// 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.
More information about the cfe-commits
mailing list