summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-11-07 20:07:17 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-11-07 20:07:17 +0000
commit2aa81a718e64fb4ca651ea12ab7afaeffc11e463 (patch)
treef1939cc5f74847f640d2c97c3ad061e9dc1b292a /clang/lib/Sema/TreeTransform.h
parenta98da3d236ac9cf8cf1e818069245fcdf307b783 (diff)
downloadbcm5719-llvm-2aa81a718e64fb4ca651ea12ab7afaeffc11e463.tar.gz
bcm5719-llvm-2aa81a718e64fb4ca651ea12ab7afaeffc11e463.zip
PR17800: When performing pack expansion, we must always rebuild the AST nodes
to avoid breaking AST invariants by reusing Stmt nodes within the same function. llvm-svn: 194217
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 2d22e4ca647..52f647083a2 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -142,7 +142,11 @@ public:
///
/// Subclasses may override this function to specify when the transformation
/// should rebuild all AST nodes.
- bool AlwaysRebuild() { return false; }
+ ///
+ /// We must always rebuild all AST nodes when performing variadic template
+ /// pack expansion, in order to avoid violating the AST invariant that each
+ /// statement node appears at most once in its containing declaration.
+ bool AlwaysRebuild() { return SemaRef.ArgumentPackSubstitutionIndex != -1; }
/// \brief Returns the location of the entity being transformed, if that
/// information was not available elsewhere in the AST.
OpenPOWER on IntegriCloud