aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/LangOptions.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-10 00:06:19 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-10 00:06:19 +0000
commit26dce44534602660ea9f4152bffc5436fc5fe3b2 (patch)
tree96930b1ee0febd8c91ad96a06bee73fdc67392e7 /include/clang/Basic/LangOptions.h
parent42745815fa4e90bfb07e581d2e5152b2c2db08ff (diff)
Limit the template instantiation depth to some user-configurable value
(default: 99). Beyond this limit, produce an error and consider the current template instantiation a failure. The stack we're building to track the instantiations will, eventually, be used to produce instantiation backtraces from diagnostics within template instantiation. However, we're not quite there yet. This adds a new Clang driver option -ftemplate-depth=NNN, which should eventually be generated from the GCC command-line operation -ftemplate-depth-NNN (note the '-' rather than the '='!). I did not make the driver changes to do this mapping. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66513 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/LangOptions.h')
-rw-r--r--include/clang/Basic/LangOptions.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index 0124b04aa9..fcfe0ca1e9 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -62,6 +62,7 @@ private:
// this enum as unsigned because MSVC insists on making enums
// signed. Set/Query this value using accessors.
public:
+ unsigned InstantiationDepth; // Maximum template instantiation depth.
enum GCMode { NonGC, GCOnly, HybridGC };
@@ -80,6 +81,8 @@ public:
Blocks = 0;
EmitAllDecls = 0;
MathErrno = 1;
+
+ InstantiationDepth = 99;
}
GCMode getGCMode() const { return (GCMode) GC; }