]> granicus.if.org Git - clang/commitdiff
Finish pushing source-location information though TreeTransform's
authorDouglas Gregor <dgregor@apple.com>
Mon, 1 Mar 2010 17:25:41 +0000 (17:25 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 1 Mar 2010 17:25:41 +0000 (17:25 +0000)
TransformDefinition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97445 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/TreeTransform.h

index fbd1a9ff1ab1604c5ea0d4c573d615fc20b4e023..8f73337e436edab560610169c37efc8c640e02ff 100644 (file)
@@ -544,7 +544,7 @@ namespace {
 
     /// \brief Transform the definition of the given declaration by
     /// instantiating it.
-    Decl *TransformDefinition(Decl *D);
+    Decl *TransformDefinition(SourceLocation Loc, Decl *D);
 
     /// \bried Transform the first qualifier within a scope by instantiating the
     /// declaration.
@@ -603,7 +603,7 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) {
   return SemaRef.FindInstantiatedDecl(Loc, cast<NamedDecl>(D), TemplateArgs);
 }
 
-Decl *TemplateInstantiator::TransformDefinition(Decl *D) {
+Decl *TemplateInstantiator::TransformDefinition(SourceLocation Loc, Decl *D) {
   Decl *Inst = getSema().SubstDecl(D, getSema().CurContext, TemplateArgs);
   if (!Inst)
     return 0;
index 4177d5249a530f1e5fdc38a79b9221def9b13e78..dccea49878732a6f18491fb48fd019519df20ae8 100644 (file)
@@ -244,7 +244,7 @@ public:
   /// By default, invokes TransformDecl() to transform the declaration.
   /// Subclasses may override this function to provide alternate behavior.
   Decl *TransformDefinition(SourceLocation Loc, Decl *D) { 
-    return getDerived().TransformDecl(D); 
+    return getDerived().TransformDecl(Loc, D); 
   }
 
   /// \brief Transform the given declaration, which was the first part of a
@@ -3117,7 +3117,9 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
   if (S->getConditionVariable()) {
     ConditionVar 
       = cast_or_null<VarDecl>(
-                   getDerived().TransformDefinition(S->getConditionVariable()));
+                   getDerived().TransformDefinition(
+                                      S->getConditionVariable()->getLocation(),
+                                                    S->getConditionVariable()));
     if (!ConditionVar)
       return SemaRef.StmtError();
   } else {
@@ -3160,7 +3162,9 @@ TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
   if (S->getConditionVariable()) {
     ConditionVar 
       = cast_or_null<VarDecl>(
-                   getDerived().TransformDefinition(S->getConditionVariable()));
+                   getDerived().TransformDefinition(
+                                      S->getConditionVariable()->getLocation(),
+                                                    S->getConditionVariable()));
     if (!ConditionVar)
       return SemaRef.StmtError();
   } else {
@@ -3197,7 +3201,9 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
   if (S->getConditionVariable()) {
     ConditionVar 
       = cast_or_null<VarDecl>(
-                   getDerived().TransformDefinition(S->getConditionVariable()));
+                   getDerived().TransformDefinition(
+                                      S->getConditionVariable()->getLocation(),
+                                                    S->getConditionVariable()));
     if (!ConditionVar)
       return SemaRef.StmtError();
   } else {
@@ -3261,7 +3267,9 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
   if (S->getConditionVariable()) {
     ConditionVar 
       = cast_or_null<VarDecl>(
-                   getDerived().TransformDefinition(S->getConditionVariable()));
+                   getDerived().TransformDefinition(
+                                      S->getConditionVariable()->getLocation(),
+                                                    S->getConditionVariable()));
     if (!ConditionVar)
       return SemaRef.StmtError();
   } else {
@@ -3349,7 +3357,8 @@ TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
   llvm::SmallVector<Decl *, 4> Decls;
   for (DeclStmt::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
        D != DEnd; ++D) {
-    Decl *Transformed = getDerived().TransformDefinition(*D);
+    Decl *Transformed = getDerived().TransformDefinition((*D)->getLocation(),
+                                                         *D);
     if (!Transformed)
       return SemaRef.StmtError();