summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/Diagnostic.td
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-06-14 07:33:30 +0000
committerDouglas Gregor <dgregor@apple.com>2009-06-14 07:33:30 +0000
commit5e9f35c7cb61aea46f56d46c77cbcf47c0cf28ba (patch)
treefadba68028102e812ff9c549c9398350fd81aaca /include/clang/Basic/Diagnostic.td
parent625b5864b5ba0552046d69830dacb951f02159ad (diff)
Update LLVM.
Implement support for C++ Substitution Failure Is Not An Error (SFINAE), which says that errors that occur during template argument deduction do *not* produce diagnostics and do not necessarily make a program ill-formed. Instead, template argument deduction silently fails. This is currently implemented for template argument deduction during matching of class template partial specializations, although the mechanism will also apply to template argument deduction for function templates. The scheme is simple: - If we are in a template argument deduction context, any diagnostic that is considered a SFINAE error (or warning) will be suppressed. The error will be propagated up the call stack via the normal means. - By default, all warnings and errors are SFINAE errors. Add the NoSFINAE class to a diagnostic in the .td file to make it a hard error (e.g., for access-control violations). Note that, to make this fully work, every place in Sema that emits an error *and then immediately recovers* will need to check Sema::isSFINAEContext() to determine whether it must immediately return an error rather than recovering. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Diagnostic.td')
-rw-r--r--include/clang/Basic/Diagnostic.td3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td
index 67d8eaafc9..6aa3b438ab 100644
--- a/include/clang/Basic/Diagnostic.td
+++ b/include/clang/Basic/Diagnostic.td
@@ -45,6 +45,7 @@ class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
string Component = ?;
string Text = text;
DiagClass Class = DC;
+ bit SFINAE = 1;
DiagMapping DefaultMapping = defaultmapping;
DiagGroup Group;
}
@@ -61,6 +62,8 @@ class DefaultWarn { DiagMapping DefaultMapping = MAP_WARNING; }
class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; }
class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; }
+class NoSFINAE { bit SFINAE = 0; }
+
// Definitions for Diagnostics.
include "DiagnosticASTKinds.td"
include "DiagnosticAnalysisKinds.td"