Tue, 06 May 2014 09:56:55 -0400
8041620: Solaris Studio 12.4 C++ 5.13 change in behavior for placing friend declarations within surrounding scope.
Summary: Remove adlc's unused class FileBuffRegion.
Reviewed-by: coleenp, dholmes, kvn
src/share/vm/adlc/filebuff.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/adlc/filebuff.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/adlc/filebuff.cpp Tue Oct 29 16:02:21 2019 +0100 1.2 +++ b/src/share/vm/adlc/filebuff.cpp Tue May 06 09:56:55 2014 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -89,200 +89,6 @@ 1.11 return retval; 1.12 } 1.13 1.14 -//------------------------------FileBuffRegion--------------------------------- 1.15 -// Create a new region in a FileBuff. 1.16 -FileBuffRegion::FileBuffRegion( FileBuff* bufr, int soln, int ln, 1.17 - int off, int len) 1.18 -: _bfr(bufr), _sol(soln), _line(ln), _offset(off), _length(len) { 1.19 - _next = NULL; // No chained regions 1.20 -} 1.21 - 1.22 -//------------------------------~FileBuffRegion-------------------------------- 1.23 -// Delete the entire linked list of buffer regions. 1.24 -FileBuffRegion::~FileBuffRegion() { 1.25 - if( _next ) delete _next; 1.26 -} 1.27 - 1.28 -//------------------------------copy------------------------------------------- 1.29 -// Deep copy a FileBuffRegion 1.30 -FileBuffRegion *FileBuffRegion::copy() { 1.31 - if( !this ) return NULL; // The empty buffer region 1.32 - FileBuffRegion *br = new FileBuffRegion(_bfr,_sol,_line,_offset,_length); 1.33 - if( _next ) br->_next = _next->copy(); 1.34 - return br; 1.35 -} 1.36 - 1.37 -//------------------------------merge------------------------------------------ 1.38 -// Merge another buffer region into this buffer region. Make overlapping areas 1.39 -// become a single region. Remove (delete) the input FileBuffRegion. 1.40 -// Since the buffer regions are sorted by file offset, this is a varient of a 1.41 -// "sorted-merge" running in linear time. 1.42 -FileBuffRegion *FileBuffRegion::merge( FileBuffRegion *br ) { 1.43 - if( !br ) return this; // Merging nothing 1.44 - if( !this ) return br; // Merging into nothing 1.45 - 1.46 - assert( _bfr == br->_bfr, "" ); // Check for pointer-equivalent buffers 1.47 - 1.48 - if( _offset < br->_offset ) { // "this" starts before "br" 1.49 - if( _offset+_length < br->_offset ) { // "this" ends before "br" 1.50 - if( _next ) _next->merge( br ); // Merge with remainder of list 1.51 - else _next = br; // No more in this list; just append. 1.52 - } else { // Regions overlap. 1.53 - int l = br->_offset + br->_length - _offset; 1.54 - if( l > _length ) _length = l; // Pick larger region 1.55 - FileBuffRegion *nr = br->_next; // Get rest of region 1.56 - br->_next = NULL; // Remove indication of rest of region 1.57 - delete br; // Delete this region (it's been subsumed). 1.58 - if( nr ) merge( nr ); // Merge with rest of region 1.59 - } // End of if regions overlap or not. 1.60 - } else { // "this" starts after "br" 1.61 - if( br->_offset+br->_length < _offset ) { // "br" ends before "this" 1.62 - FileBuffRegion *nr = new FileBuffRegion(_bfr,_sol,_line,_offset,_length); 1.63 - nr->_next = _next; // Structure copy "this" guy to "nr" 1.64 - *this = *br; // Structure copy "br" over "this". 1.65 - br->_next = NULL; // Remove indication of rest of region 1.66 - delete br; // Delete this region (it's been copied) 1.67 - merge( nr ); // Finish merging 1.68 - } else { // Regions overlap. 1.69 - int l = _offset + _length - br->_offset; 1.70 - if( l > _length ) _length = l; // Pick larger region 1.71 - _offset = br->_offset; // Start with earlier region 1.72 - _sol = br->_sol; // Also use earlier line start 1.73 - _line = br->_line; // Also use earlier line 1.74 - FileBuffRegion *nr = br->_next; // Get rest of region 1.75 - br->_next = NULL; // Remove indication of rest of region 1.76 - delete br; // Delete this region (it's been subsumed). 1.77 - if( nr ) merge( nr ); // Merge with rest of region 1.78 - } // End of if regions overlap or not. 1.79 - } 1.80 - return this; 1.81 -} 1.82 - 1.83 -//------------------------------expandtab-------------------------------------- 1.84 -static int expandtab( ostream &os, int off, char c, char fill1, char fill2 ) { 1.85 - if( c == '\t' ) { // Tab? 1.86 - do os << fill1; // Expand the tab; Output space 1.87 - while( (++off) & 7 ); // Expand to tab stop 1.88 - } else { // Normal character 1.89 - os << fill2; // Display normal character 1.90 - off++; // Increment "cursor" offset 1.91 - } 1.92 - return off; 1.93 -} 1.94 - 1.95 -//------------------------------printline-------------------------------------- 1.96 -// Print and highlite a region of a line. Return the amount of highliting left 1.97 -// to do (i.e. highlite length minus length of line). 1.98 -static int printline( ostream& os, const char *fname, int line, 1.99 - const char *_sol, int skip, int len ) { 1.100 - 1.101 - // Display the entire tab-expanded line 1.102 - os << fname << ":" << line << ": "; 1.103 - const char *t = strchr(_sol,'\n')+1; // End of line 1.104 - int off = 0; // Cursor offset for tab expansion 1.105 - const char *s = _sol; // Nice string pointer 1.106 - while( t-s ) { // Display whole line 1.107 - char c = *s++; // Get next character to display 1.108 - off = expandtab(os,off,c,' ',c); 1.109 - } 1.110 - 1.111 - // Display the tab-expanded skippings before underlining. 1.112 - os << fname << ":" << line << ": "; 1.113 - off = 0; // Cursor offset for tab expansion 1.114 - s = _sol; // Restart string pointer 1.115 - 1.116 - // Start underlining. 1.117 - if( skip != -1 ) { // The no-start-indicating flag 1.118 - const char *u = _sol+skip; // Amount to skip 1.119 - while( u-s ) // Display skipped part 1.120 - off = expandtab(os,off,*s++,' ',' '); 1.121 - os << '^'; // Start region 1.122 - off++; // Moved cursor 1.123 - len--; // 1 less char to do 1.124 - if( *s++ == '\t' ) // Starting character is a tab? 1.125 - off = expandtab(os,off,'\t','-','^'); 1.126 - } 1.127 - 1.128 - // Long region doesn't end on this line 1.129 - int llen = (int)(t-s); // Length of line, minus what's already done 1.130 - if( len > llen ) { // Doing entire rest of line? 1.131 - while( t-s ) // Display rest of line 1.132 - off = expandtab(os,off,*s++,'-','-'); 1.133 - os << '\n'; // EOL 1.134 - return len-llen; // Return what's not yet done. 1.135 - } 1.136 - 1.137 - // Region does end on this line. This code fails subtly if the region ends 1.138 - // in a tab character. 1.139 - int i; 1.140 - for( i=1; i<len; i++ ) // Underline just what's needed 1.141 - off = expandtab(os,off,*s++,'-','-'); 1.142 - if( i == len ) os << '^'; // Mark end of region 1.143 - os << '\n'; // End of marked line 1.144 - return 0; // All done 1.145 -} 1.146 - 1.147 -//------------------------------print------------------------------------------ 1.148 -//std::ostream& operator<< ( std::ostream& os, FileBuffRegion &br ) { 1.149 -ostream& operator<< ( ostream& os, FileBuffRegion &br ) { 1.150 - if( &br == NULL ) return os; // The empty buffer region 1.151 - FileBuffRegion *brp = &br; // Pointer to region 1.152 - while( brp ) { // While have chained regions 1.153 - brp->print(os); // Print region 1.154 - brp = brp->_next; // Chain to next 1.155 - } 1.156 - return os; // Return final stream 1.157 -} 1.158 - 1.159 -//------------------------------print------------------------------------------ 1.160 -// Print the FileBuffRegion to a stream. FileBuffRegions are printed with the 1.161 -// filename and line number to the left, and complete text lines to the right. 1.162 -// Selected portions (portions of a line actually in the FileBuffRegion are 1.163 -// underlined. Ellipses are used for long multi-line regions. 1.164 -//void FileBuffRegion::print( std::ostream& os ) { 1.165 -void FileBuffRegion::print( ostream& os ) { 1.166 - if( !this ) return; // Nothing to print 1.167 - char *s = _bfr->get_line(); 1.168 - int skip = (int)(_offset - _sol); // Amount to skip to start of data 1.169 - int len = printline( os, _bfr->_fp->_name, _line, s, skip, _length ); 1.170 - 1.171 - if( !len ) return; // All done; exit 1.172 - 1.173 - // Here we require at least 2 lines 1.174 - int off1 = _length - len + skip; // Length of line 1 1.175 - int off2 = off1 + _sol; // Offset to start of line 2 1.176 - char *s2 = _bfr->get_line(); // Start of line 2 1.177 - char *s3 = strchr( s2, '\n' )+1; // Start of line 3 (unread) 1.178 - if( len <= (s3-s2) ) { // It all fits on the next line 1.179 - printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Print&underline 1.180 - return; 1.181 - } 1.182 - 1.183 - // Here we require at least 3 lines 1.184 - int off3 = off2 + (int)(s3-s2); // Offset to start of line 3 1.185 - s3 = _bfr->get_line(); // Start of line 3 (read) 1.186 - const char *s4 = strchr( s3, '\n' )+1;// Start of line 4 (unread) 1.187 - if( len < (s4-s3) ) { // It all fits on the next 2 lines 1.188 - s2 = _bfr->get_line(); 1.189 - len = printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Line 2 1.190 - s3 = _bfr->get_line(); 1.191 - printline( os, _bfr->_fp->_name, _line+2, s3, -1, len ); // Line 3 1.192 - return; 1.193 - } 1.194 - 1.195 - // Here we require at least 4 lines. 1.196 - // Print only the 1st and last line, with ellipses in middle. 1.197 - os << "...\n"; // The ellipses 1.198 - int cline = _line+1; // Skipped 2 lines 1.199 - do { // Do until find last line 1.200 - len -= (int)(s3-s2); // Remove length of line 1.201 - cline++; // Next line 1.202 - s2 = _bfr->get_line(); // Get next line from end of this line 1.203 - s3 = strchr( s2, '\n' ) + 1;// Get end of next line 1.204 - } while( len > (s3-s2) ); // Repeat until last line 1.205 - printline( os, _bfr->_fp->_name, cline, s2, -1, len ); // Print & underline 1.206 -} 1.207 - 1.208 //------------------------------file_error------------------------------------- 1.209 void FileBuff::file_error(int flag, int linenum, const char *fmt, ...) 1.210 {
2.1 --- a/src/share/vm/adlc/filebuff.hpp Tue Oct 29 16:02:21 2019 +0100 2.2 +++ b/src/share/vm/adlc/filebuff.hpp Tue May 06 09:56:55 2014 -0400 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -46,7 +46,6 @@ 2.11 // This class defines a nicely behaved buffer of text. Entire file of text 2.12 // is read into buffer at creation, with sentinels at start and end. 2.13 class FileBuff { 2.14 - friend class FileBuffRegion; 2.15 private: 2.16 long _bufferSize; // Size of text holding buffer. 2.17 long _offset; // Expected filepointer offset. 2.18 @@ -82,29 +81,4 @@ 2.19 // when the pointer is valid (i.e. just obtained from getline()). 2.20 long getoff(const char* s) { return _bufoff + (long)(s - _buf); } 2.21 }; 2.22 - 2.23 -//------------------------------FileBuffRegion--------------------------------- 2.24 -// A buffer region is really a region of some file, specified as a linked list 2.25 -// of offsets and lengths. These regions can be merged; overlapping regions 2.26 -// will coalesce. 2.27 -class FileBuffRegion { 2.28 - public: // Workaround dev-studio friend/private bug 2.29 - FileBuffRegion *_next; // Linked list of regions sorted by offset. 2.30 - private: 2.31 - FileBuff *_bfr; // The Buffer of the file 2.32 - int _offset, _length; // The file area 2.33 - int _sol; // Start of line where the file area starts 2.34 - int _line; // First line of region 2.35 - 2.36 - public: 2.37 - FileBuffRegion(FileBuff*, int sol, int line, int offset, int len); 2.38 - ~FileBuffRegion(); 2.39 - 2.40 - FileBuffRegion *copy(); // Deep copy 2.41 - FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input 2.42 - 2.43 - void print(ostream&); 2.44 - friend ostream& operator<< (ostream&, FileBuffRegion&); 2.45 -}; 2.46 - 2.47 #endif // SHARE_VM_ADLC_FILEBUFF_HPP