[cfe-commits] r127339 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/ASTUnit.h include/clang/Frontend/PreprocessorOptions.h include/clang/Serialization/ASTReader.h include/clang/Serialization/ChainedIncludesSource.h lib/Frontend/ASTUnit.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/FrontendAction.cpp lib/Serialization/ASTReader.cpp lib/Serialization/ChainedIncludesSource.cpp test/PCH/chain-cxx.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Wed Mar 9 15:19:58 PST 2011


On Mar 9, 2011, at 2:58 PM, Dimitry Andric wrote:

> On 2011-03-09 18:21, Argyrios Kyrtzidis wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=127339&view=rev
>> Log:
>> Introduce '-chain-include' option to specify headers that will be converted to chained PCHs in memory
>> without having to use multiple runs and intermediate files.
> ...
>> Added: cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp?rev=127339&view=auto
> 
> ...
>> +  for (unsigned i = 0, e = includes.size(); i != e; ++i) {
>> +    bool firstInclude = (i == 0);
> ...
>> +      for (unsigned i = 0, e = serialBufs.size(); i != e; ++i) {
>> +        bufs.push_back(llvm::MemoryBuffer::getMemBufferCopy(
>> +                              llvm::StringRef(serialBufs[i]->getBufferStart(),
>> +                                              serialBufs[i]->getBufferSize())));
>> +      }
>> +      std::string pchName = includes[i-1];
>> +      llvm::raw_string_ostream os(pchName);
>> +      os<<  ".pch"<<  i-1;
> 
> These nested for loops, both having 'unsigned i' variables, make g++
> complain:
> 
> tools/clang/lib/Serialization/ChainedIncludesSource.cpp: In static member function 'static clang::ChainedIncludesSource* clang::ChainedIncludesSource::create(clang::CompilerInstance&)':
> tools/clang/lib/Serialization/ChainedIncludesSource.cpp:122: warning: name lookup of 'i' changed
> tools/clang/lib/Serialization/ChainedIncludesSource.cpp:67: warning:   matches this 'i' under ISO standard rules
> tools/clang/lib/Serialization/ChainedIncludesSource.cpp:117: warning:   matches this 'i' under old rules
> 
> If the "std::string pchName = includes[i-1];" and "os<< ".pch"<< i-1;"
> lines are supposed to use the 'outer' i, could you maybe just rename the
> 'inner' i, to shut up the warning?

Done in r127370.





More information about the cfe-commits mailing list