Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Richard Trieu via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL248454: Improve the printing of ranges when macros are involved. (authored by rtrieu). Changed prior to commit: http://reviews.llvm.org/D12379?vs=35575&id=35580#toc Repository: rL LLVM http://review

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 35575. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/Misc/diag-macro-backtrace2.c test/Misc/red

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 35574. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/Misc/diag-macro-backtrace2.c test/Misc/red

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 35573. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/Misc/diag-macro-backtrace2.c test/Misc/red

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai added inline comments. Comment at: lib/Frontend/DiagnosticRenderer.cpp:442 @@ -419,1 +441,3 @@ +/// Check if the current location fit in the macro argument expansion +/// Especially, it should fit in the same argument with all the other locations Explai

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 35561. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/Misc/diag-macro-backtrace2.c test/Misc/red

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Richard Trieu via cfe-commits
rtrieu added inline comments. Comment at: lib/Frontend/DiagnosticRenderer.cpp:442 @@ -419,1 +441,3 @@ +static bool checkLocForMacroArgExpansion(SourceLocation Loc, + const SourceManager &SM, zhengkai wrote: > I have stated

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai marked an inline comment as done. Comment at: lib/Frontend/DiagnosticRenderer.cpp:442 @@ -419,1 +441,3 @@ +static bool checkLocForMacroArgExpansion(SourceLocation Loc, + const SourceManager &SM, I have stated that

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 35556. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/Misc/diag-macro-backtrace2.c test/Misc/red

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Richard Trieu via cfe-commits
rtrieu added inline comments. Comment at: lib/Frontend/DiagnosticRenderer.cpp:455 @@ -419,1 +454,3 @@ +static bool checkLocForMacroArgExpansion(SourceLocation Loc, + const SourceManager &SM, rtrieu wrote: > zhengkai wrote:

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 35554. zhengkai marked 11 inline comments as done. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-23 Thread Zhengkai Wu via cfe-commits
zhengkai added inline comments. Comment at: lib/Frontend/DiagnosticRenderer.cpp:323 @@ +322,3 @@ + else +Backup = SM->getImmediateSpellingLoc(Backup); + rtrieu wrote: > You did not add that here. The getImmediateMacroCallerLoc is implemented as following:

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-22 Thread Richard Trieu via cfe-commits
rtrieu added inline comments. Comment at: lib/Basic/SourceManager.cpp:1008 @@ -1008,1 +1007,3 @@ +bool SourceManager::isMacroArgExpansion(SourceLocation Loc, + SourceLocation *NewLoc) const { if (!Loc.isMacroID()) return false;

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-17 Thread Zhengkai Wu via cfe-commits
zhengkai marked 2 inline comments as done. Comment at: lib/Frontend/DiagnosticRenderer.cpp:455 @@ -419,1 +454,3 @@ +static bool checkLocForMacroArgExpansion(SourceLocation Loc, + const SourceManager &SM, Because the functi

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-16 Thread Zhengkai Wu via cfe-commits
zhengkai added inline comments. Comment at: lib/Frontend/DiagnosticRenderer.cpp:312 @@ +311,3 @@ + +static bool retrieveBeginLocation(SourceLocation &Begin, + FileID &BeginFileID, rtrieu wrote: > Why not return a SourceLocation instead

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-16 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 34943. zhengkai marked 8 inline comments as done. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c test/M

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-15 Thread Richard Trieu via cfe-commits
rtrieu added inline comments. Comment at: include/clang/Basic/SourceManager.h:333 @@ -332,2 +332,3 @@ + bool isMacroBodyExpansion() const { Remove unrelated whitespace change. Comment at: include/clang/Basic/SourceManager.h:1155-1164 @@ -1

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-15 Thread Zhengkai Wu via cfe-commits
zhengkai added a comment. In http://reviews.llvm.org/D12379#245892, @rtrieu wrote: > In http://reviews.llvm.org/D12379#245868, @zhengkai wrote: > > > In http://reviews.llvm.org/D12379#245861, @rtrieu wrote: > > > > > In http://reviews.llvm.org/D12379#245850, @zhengkai wrote: > > > > > > > In http

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-15 Thread Zhengkai Wu via cfe-commits
zhengkai updated this revision to Diff 34826. zhengkai added a comment. Use the rtrieu's method to re write the implementation of SourceManager. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-14 Thread Richard Trieu via cfe-commits
rtrieu added a comment. In http://reviews.llvm.org/D12379#245868, @zhengkai wrote: > In http://reviews.llvm.org/D12379#245861, @rtrieu wrote: > > > In http://reviews.llvm.org/D12379#245850, @zhengkai wrote: > > > > > In http://reviews.llvm.org/D12379#245849, @rtrieu wrote: > > > > > > > Why are y

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-14 Thread Zhengkai Wu via cfe-commits
zhengkai added a comment. In http://reviews.llvm.org/D12379#245861, @rtrieu wrote: > In http://reviews.llvm.org/D12379#245850, @zhengkai wrote: > > > In http://reviews.llvm.org/D12379#245849, @rtrieu wrote: > > > > > Why are you leaking the raw encoding of locations from the SourceManager? > > >

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-14 Thread Richard Trieu via cfe-commits
rtrieu added a comment. In http://reviews.llvm.org/D12379#245850, @zhengkai wrote: > In http://reviews.llvm.org/D12379#245849, @rtrieu wrote: > > > Why are you leaking the raw encoding of locations from the SourceManager? > > This is an internal implementation detail and should not be relied on

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-14 Thread Zhengkai Wu via cfe-commits
zhengkai added a comment. In http://reviews.llvm.org/D12379#245849, @rtrieu wrote: > Why are you leaking the raw encoding of locations from the SourceManager? > This is an internal implementation detail and should not be relied on > externally. SourceLocation is the typical way to use locatio

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-14 Thread Richard Trieu via cfe-commits
rtrieu added a comment. Why are you leaking the raw encoding of locations from the SourceManager? This is an internal implementation detail and should not be relied on externally. SourceLocation is the typical way to use locations. http://reviews.llvm.org/D12379 __

Re: [PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-09-11 Thread Zhengkai Wu via cfe-commits
zhengkai updated the summary for this revision. zhengkai updated this revision to Diff 34588. http://reviews.llvm.org/D12379 Files: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp lib/Frontend/DiagnosticRenderer.cpp test/Index/fix-its.m test/Misc/caret-diags-macros.c t

[PATCH] D12379: Fix the bugs in the mapDiagnosticRanges (Still in progress)

2015-08-26 Thread Zhengkai Wu via cfe-commits
zhengkai created this revision. zhengkai added a reviewer: rtrieu. zhengkai added a subscriber: cfe-commits. Use a new algorithm to find map back the ranges to its spelling locations. But the function is not working properly either, and it breaks a test. In the last case in the test file /llvm/