]> granicus.if.org Git - clang/commitdiff
Pass SourceRanges by reference to the various Diag methods.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 24 Aug 2008 13:14:02 +0000 (13:14 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 24 Aug 2008 13:14:02 +0000 (13:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55284 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Parser.h
lib/Parse/Parser.cpp
lib/Sema/Sema.cpp
lib/Sema/Sema.h

index 6f9ca22ba96ac3af9a04a964951ca93e5f0f4bac..5fa62050e7298fbd6fee31ed5719127031b4e40e 100644 (file)
@@ -246,7 +246,7 @@ private:
             const std::string &Msg = std::string());
   bool Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R);
   bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
-            SourceRange R1);
+            const SourceRange& R1);
   bool Diag(const Token &Tok, unsigned DiagID,
             const std::string &M = std::string()) {
     return Diag(Tok.getLocation(), DiagID, M);
index c6b0a80e02eb1db16989fca0c00a2070a95b52c6..7598ff79969be21425a0af8caad6ec0d6ac07413 100644 (file)
@@ -39,7 +39,7 @@ bool Parser::Diag(SourceLocation Loc, unsigned DiagID,
 }
 
 bool Parser::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
-                  SourceRange Range) {
+                  const SourceRange& Range) {
   Diags.Report(PP.getFullLoc(Loc), DiagID, &Msg, 1, &Range,1);
   return true;
 }
index fa8ba5953cfa9d92d103207ff235342ba14f3de9..30ada28d8bcd15a01da6f4673203c1084f2a8fc4 100644 (file)
@@ -160,19 +160,19 @@ bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
   return true;
 }
 
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, SourceRange Range) {
+bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& Range) {
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, 0, 0, &Range,1);
   return true;
 }
 
 bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
-                SourceRange Range) {
+                const SourceRange& Range) {
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, &Msg, 1, &Range,1);
   return true;
 }
 
 bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
-                const std::string &Msg2, SourceRange Range) {
+                const std::string &Msg2, const SourceRange& Range) {
   std::string MsgArr[] = { Msg1, Msg2 };
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, MsgArr, 2, &Range, 1);
   return true;
@@ -180,28 +180,29 @@ bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
 
 bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, 
                 const std::string &Msg2, const std::string &Msg3, 
-                SourceRange R1) {
+                const SourceRange& R1) {
   std::string MsgArr[] = { Msg1, Msg2, Msg3 };
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, MsgArr, 3, &R1, 1);
   return true;
 }
 
 bool Sema::Diag(SourceLocation Loc, unsigned DiagID,
-                SourceRange R1, SourceRange R2) {
+                const SourceRange& R1, const SourceRange& R2) {
   SourceRange RangeArr[] = { R1, R2 };
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, 0, 0, RangeArr, 2);
   return true;
 }
 
 bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
-                SourceRange R1, SourceRange R2) {
+                const SourceRange& R1, const SourceRange& R2) {
   SourceRange RangeArr[] = { R1, R2 };
   PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID,  &Msg, 1, RangeArr, 2);
   return true;
 }
 
 bool Sema::Diag(SourceLocation Range, unsigned DiagID, const std::string &Msg1,
-                const std::string &Msg2, SourceRange R1, SourceRange R2) {
+                const std::string &Msg2, const SourceRange& R1,
+                const SourceRange& R2) {
   std::string MsgArr[] = { Msg1, Msg2 };
   SourceRange RangeArr[] = { R1, R2 };
   PP.getDiagnostics().Report(PP.getFullLoc(Range),DiagID, MsgArr,2,RangeArr, 2);
index c5ab94a7e4c853e7429537ef3a17fd0029b03be3..4bfbcb9939a03aafa7c5df207fe8824b991e9c0d 100644 (file)
@@ -179,20 +179,21 @@ public:
             const std::string &Msg2);
 
   /// More expressive diagnostic helpers for expressions (say that 6 times:-)
-  bool Diag(SourceLocation Loc, unsigned DiagID, SourceRange R1);
+  bool Diag(SourceLocation Loc, unsigned DiagID, const SourceRange& R1);
   bool Diag(SourceLocation Loc, unsigned DiagID, 
-            SourceRange R1, SourceRange R2);
+            const SourceRange& R1, const SourceRange& R2);
   bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
-            SourceRange R1);
+            const SourceRange& R1);
   bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
-            SourceRange R1, SourceRange R2);
+            const SourceRange& R1, const SourceRange& R2);
   bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, 
-            const std::string &Msg2, SourceRange R1);
+            const std::string &Msg2, const SourceRange& R1);
   bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1, 
-            const std::string &Msg2, const std::string &Msg3, SourceRange R1);
+            const std::string &Msg2, const std::string &Msg3,
+            const SourceRange& R1);
   bool Diag(SourceLocation Loc, unsigned DiagID, 
             const std::string &Msg1, const std::string &Msg2, 
-            SourceRange R1, SourceRange R2);
+            const SourceRange& R1, const SourceRange& R2);
   
   virtual void DeleteExpr(ExprTy *E);
   virtual void DeleteStmt(StmtTy *S);