On Jul 29, 2013, at 1:38 PM, Sebastian Pop <[email protected]> wrote:
> On Fri, Jul 26, 2013 at 10:32 AM, Argyrios Kyrtzidis <[email protected]> > wrote: >> Author: akirtzidis >> Date: Fri Jul 26 10:32:04 2013 >> New Revision: 187207 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=187207&view=rev >> Log: >> [frontend] '-frewrite-includes' should not ignore headers included from >> command-line. >> >> rdar://14556182 >> >> Added: >> cfe/trunk/test/Frontend/rewrite-includes-header-cmd-line.c >> Modified: >> cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp > > This patch breaks Hexagon's buildbots: > > http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/803 > > ******************** > Failing Tests (1): > Clang :: Driver/qa_override.c I don't see how the patch would affect this test in any way. Did you verify by reverting the patch locally and retrying the test ? > > To reproduce, in a linux box, configure with: > > $ ../configure --disable-bindings --build=x86_64-linux-gnu > --host=x86_64-linux-gnu --target=hexagon-unknown-elf > --enable-targets=hexagon --build=hexagon-unknown-elf > --host=hexagon-unknown-elf --without-llvmgcc --without-llvmgxx > --enable-optimized --enable-assertions > $ make && make check-all > > Thanks, > Sebastian > >> >> Modified: cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp?rev=187207&r1=187206&r2=187207&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp (original) >> +++ cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp Fri Jul 26 10:32:04 >> 2013 >> @@ -40,6 +40,7 @@ class InclusionRewriter : public PPCallb >> Preprocessor &PP; ///< Used to find inclusion directives. >> SourceManager &SM; ///< Used to read and manage source files. >> raw_ostream &OS; ///< The destination stream for rewritten contents. >> + const llvm::MemoryBuffer *PredefinesBuffer; ///< The preprocessor >> predefines. >> bool ShowLineMarkers; ///< Show #line markers. >> bool UseLineDirective; ///< Use of line directives or line markers. >> typedef std::map<unsigned, FileChange> FileChangeMap; >> @@ -50,6 +51,9 @@ class InclusionRewriter : public PPCallb >> public: >> InclusionRewriter(Preprocessor &PP, raw_ostream &OS, bool ShowLineMarkers); >> bool Process(FileID FileId, SrcMgr::CharacteristicKind FileType); >> + void setPredefinesBuffer(const llvm::MemoryBuffer *Buf) { >> + PredefinesBuffer = Buf; >> + } >> private: >> virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, >> SrcMgr::CharacteristicKind FileType, >> @@ -89,7 +93,7 @@ private: >> /// Initializes an InclusionRewriter with a \p PP source and \p OS >> destination. >> InclusionRewriter::InclusionRewriter(Preprocessor &PP, raw_ostream &OS, >> bool ShowLineMarkers) >> - : PP(PP), SM(PP.getSourceManager()), OS(OS), >> + : PP(PP), SM(PP.getSourceManager()), OS(OS), PredefinesBuffer(0), >> ShowLineMarkers(ShowLineMarkers), >> LastInsertedFileChange(FileChanges.end()) { >> // If we're in microsoft mode, use normal #line instead of line markers. >> @@ -214,6 +218,11 @@ void InclusionRewriter::OutputContentUpT >> bool EnsureNewline) { >> if (WriteTo <= WriteFrom) >> return; >> + if (&FromFile == PredefinesBuffer) { >> + // Ignore the #defines of the predefines buffer. >> + WriteFrom = WriteTo; >> + return; >> + } >> OS.write(FromFile.getBufferStart() + WriteFrom, WriteTo - WriteFrom); >> // count lines manually, it's faster than getPresumedLoc() >> Line += std::count(FromFile.getBufferStart() + WriteFrom, >> @@ -525,6 +534,8 @@ void clang::RewriteIncludesInInput(Prepr >> do { >> PP.Lex(Tok); >> } while (Tok.isNot(tok::eof)); >> + Rewrite->setPredefinesBuffer(SM.getBuffer(PP.getPredefinesFileID())); >> + Rewrite->Process(PP.getPredefinesFileID(), SrcMgr::C_User); >> Rewrite->Process(SM.getMainFileID(), SrcMgr::C_User); >> OS->flush(); >> } >> >> Added: cfe/trunk/test/Frontend/rewrite-includes-header-cmd-line.c >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/rewrite-includes-header-cmd-line.c?rev=187207&view=auto >> ============================================================================== >> --- cfe/trunk/test/Frontend/rewrite-includes-header-cmd-line.c (added) >> +++ cfe/trunk/test/Frontend/rewrite-includes-header-cmd-line.c Fri Jul 26 >> 10:32:04 2013 >> @@ -0,0 +1,7 @@ >> +// RUN: %clang_cc1 -E -frewrite-includes -include rewrite-includes2.h -I >> %S/Inputs %s -o - | FileCheck -strict-whitespace %s >> + >> +// STARTMAIN >> + >> +// CHECK-NOT: {{^}}#define >> +// CHECK: included_line2 >> +// CHECK: {{^}}// STARTMAIN{{$}} >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > hosted by The Linux Foundation
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
