r305684 - [NFC] Refactor DiagnosticRenderer to use FullSourceLoc
Author: christof Date: Mon Jun 19 07:05:58 2017 New Revision: 305684 URL: http://llvm.org/viewvc/llvm-project?rev=305684&view=rev Log: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. Patch by Sanne Wouda Review: https://reviews.llvm.org/D31709 Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd Modified: cfe/trunk/include/clang/Basic/SourceLocation.h cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h cfe/trunk/include/clang/Frontend/TextDiagnostic.h cfe/trunk/lib/Basic/SourceLocation.cpp cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp cfe/trunk/lib/Frontend/TextDiagnostic.cpp cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp cfe/trunk/tools/libclang/CIndexDiagnostic.cpp Modified: cfe/trunk/include/clang/Basic/SourceLocation.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=305684&r1=305683&r2=305684&view=diff == --- cfe/trunk/include/clang/Basic/SourceLocation.h (original) +++ cfe/trunk/include/clang/Basic/SourceLocation.h Mon Jun 19 07:05:58 2017 @@ -262,6 +262,65 @@ public: bool isInvalid() const { return !isValid(); } }; +/// \brief Represents an unpacked "presumed" location which can be presented +/// to the user. +/// +/// A 'presumed' location can be modified by \#line and GNU line marker +/// directives and is always the expansion point of a normal location. +/// +/// You can get a PresumedLoc from a SourceLocation with SourceManager. +class PresumedLoc { + const char *Filename; + unsigned Line, Col; + SourceLocation IncludeLoc; + +public: + PresumedLoc() : Filename(nullptr) {} + PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL) + : Filename(FN), Line(Ln), Col(Co), IncludeLoc(IL) {} + + /// \brief Return true if this object is invalid or uninitialized. + /// + /// This occurs when created with invalid source locations or when walking + /// off the top of a \#include stack. + bool isInvalid() const { return Filename == nullptr; } + bool isValid() const { return Filename != nullptr; } + + /// \brief Return the presumed filename of this location. + /// + /// This can be affected by \#line etc. + const char *getFilename() const { +assert(isValid()); +return Filename; + } + + /// \brief Return the presumed line number of this location. + /// + /// This can be affected by \#line etc. + unsigned getLine() const { +assert(isValid()); +return Line; + } + + /// \brief Return the presumed column number of this location. + /// + /// This cannot be affected by \#line, but is packaged here for convenience. + unsigned getColumn() const { +assert(isValid()); +return Col; + } + + /// \brief Return the presumed include location of this location. + /// + /// This can be affected by GNU linemarker directives. + SourceLocation getIncludeLoc() const { +assert(isValid()); +return IncludeLoc; + } +}; + +class FileEntry; + /// \brief A SourceLocation and its associated SourceManager. /// /// This is useful for argument passing to functions that expect both objects. @@ -274,6 +333,12 @@ public: explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} + bool hasManager() const { + bool hasSrcMgr = SrcMgr != nullptr; + assert(hasSrcMgr == isValid() && "FullSourceLoc has location but no manager"); + return hasSrcMgr; + } + /// \pre This FullSourceLoc has an associated SourceManager. const SourceManager &getManager() const { assert(SrcMgr && "SourceManager is NULL."); @@ -284,6 +349,13 @@ public: FullSourceLoc getExpansionLoc() const; FullSourceLoc getSpellingLoc() const; + FullSourceLoc getFileLoc() const; + std::pair getImmediateExpansionRange() const; + PresumedLoc getPresumedLoc(bool UseLineDirectives = true) const; + bool isMacroArgExpansion(FullSourceLoc *StartLoc = nullptr) const; + FullSourceLoc getImmediateMacroCallerLoc() const; + std::pair getModuleImportLoc() const; + unsigned getFileOffset() const; unsigned getExpansionLineNumber(bool *Invalid = nullptr) const; unsigned getExpansionColumnNumber(bool *Invalid = nullptr) const; @@ -293,6 +365,12 @@ public: const char *getCharacterData(bool *Invalid = nullptr) const; + unsigned getLineNumber(bool *Invalid = nullptr) const; + unsigned getColumnNumber(bool *Invalid = nullptr) const; + + std::pair getExpansionRange() const; + + const FileEntry *getFileEntry() const; /// \brief Return a StringRef to the source buffer data for the /// specified Fil
r305688 - Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"
Author: christof Date: Mon Jun 19 07:41:22 2017 New Revision: 305688 URL: http://llvm.org/viewvc/llvm-project?rev=305688&view=rev Log: Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc" This reverts commit 305684. This patch breaks extra/tools/clang-tidy Modified: cfe/trunk/include/clang/Basic/SourceLocation.h cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h cfe/trunk/include/clang/Frontend/TextDiagnostic.h cfe/trunk/lib/Basic/SourceLocation.cpp cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp cfe/trunk/lib/Frontend/TextDiagnostic.cpp cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp cfe/trunk/tools/libclang/CIndexDiagnostic.cpp Modified: cfe/trunk/include/clang/Basic/SourceLocation.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=305688&r1=305687&r2=305688&view=diff == --- cfe/trunk/include/clang/Basic/SourceLocation.h (original) +++ cfe/trunk/include/clang/Basic/SourceLocation.h Mon Jun 19 07:41:22 2017 @@ -262,65 +262,6 @@ public: bool isInvalid() const { return !isValid(); } }; -/// \brief Represents an unpacked "presumed" location which can be presented -/// to the user. -/// -/// A 'presumed' location can be modified by \#line and GNU line marker -/// directives and is always the expansion point of a normal location. -/// -/// You can get a PresumedLoc from a SourceLocation with SourceManager. -class PresumedLoc { - const char *Filename; - unsigned Line, Col; - SourceLocation IncludeLoc; - -public: - PresumedLoc() : Filename(nullptr) {} - PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL) - : Filename(FN), Line(Ln), Col(Co), IncludeLoc(IL) {} - - /// \brief Return true if this object is invalid or uninitialized. - /// - /// This occurs when created with invalid source locations or when walking - /// off the top of a \#include stack. - bool isInvalid() const { return Filename == nullptr; } - bool isValid() const { return Filename != nullptr; } - - /// \brief Return the presumed filename of this location. - /// - /// This can be affected by \#line etc. - const char *getFilename() const { -assert(isValid()); -return Filename; - } - - /// \brief Return the presumed line number of this location. - /// - /// This can be affected by \#line etc. - unsigned getLine() const { -assert(isValid()); -return Line; - } - - /// \brief Return the presumed column number of this location. - /// - /// This cannot be affected by \#line, but is packaged here for convenience. - unsigned getColumn() const { -assert(isValid()); -return Col; - } - - /// \brief Return the presumed include location of this location. - /// - /// This can be affected by GNU linemarker directives. - SourceLocation getIncludeLoc() const { -assert(isValid()); -return IncludeLoc; - } -}; - -class FileEntry; - /// \brief A SourceLocation and its associated SourceManager. /// /// This is useful for argument passing to functions that expect both objects. @@ -333,12 +274,6 @@ public: explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} - bool hasManager() const { - bool hasSrcMgr = SrcMgr != nullptr; - assert(hasSrcMgr == isValid() && "FullSourceLoc has location but no manager"); - return hasSrcMgr; - } - /// \pre This FullSourceLoc has an associated SourceManager. const SourceManager &getManager() const { assert(SrcMgr && "SourceManager is NULL."); @@ -349,13 +284,6 @@ public: FullSourceLoc getExpansionLoc() const; FullSourceLoc getSpellingLoc() const; - FullSourceLoc getFileLoc() const; - std::pair getImmediateExpansionRange() const; - PresumedLoc getPresumedLoc(bool UseLineDirectives = true) const; - bool isMacroArgExpansion(FullSourceLoc *StartLoc = nullptr) const; - FullSourceLoc getImmediateMacroCallerLoc() const; - std::pair getModuleImportLoc() const; - unsigned getFileOffset() const; unsigned getExpansionLineNumber(bool *Invalid = nullptr) const; unsigned getExpansionColumnNumber(bool *Invalid = nullptr) const; @@ -365,12 +293,6 @@ public: const char *getCharacterData(bool *Invalid = nullptr) const; - unsigned getLineNumber(bool *Invalid = nullptr) const; - unsigned getColumnNumber(bool *Invalid = nullptr) const; - - std::pair getExpansionRange() const; - - const FileEntry *getFileEntry() const; /// \brief Return a StringRef to the source buffer data for the /// specified FileID. @@ -423,6 +345,50 @@ public: }; +/// \brief Represents an unpacked "presumed" location which can be presented +/// to the user. +/// +/// A 'presumed' location can be modified by \#line and GNU line marker +/// directives and is always the expansion point of a normal location. +/// +/// You can get a PresumedL
Re: [libcxx] r342073 - Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955
Hi Marshall and others. After this discussion and some internal discussions I agree with the idea that files without extension are treated as C++ header files and non-header files should either move out of the C++ code base or have a proper extension. The VERSION case is just the most visible case of it. The introduction of new headers that break existing projects can be handled with the use of -iquote or by using project specific names if people care about future proofing their projects. Makes me wonder if clang should make -I to mean -iquote and have an -iangle option for the language headers instead. Anyway, I’m happy to leave it at this. Thanks for everybody’s time and thoughts on this. Thanks, Christof From: Marshall Clow Date: Monday, 22 October 2018 at 15:41 To: Christof Douma Cc: "cfe-commits@lists.llvm.org" , nd , Arnaud De Grandmaison , Jonathan Wakely Subject: Re: [libcxx] r342073 - Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 On Tue, Oct 2, 2018 at 10:33 AM Christof Douma mailto:christof.do...@arm.com>> wrote: Hi Marshall. I think that this patch breaks backwards compatibility. Assumes that the header file "version" is used by C++ projects that use a C++ standard that did not specify a 'version' header. Many toolchains will put search paths specified with -I in front of the system search path. The result is that the application header file is included whenever a standard header file is included. That is unexpected and can break builds. Do you agree this is an issue or do you consider this an issue with the way toolchains handle include search paths? Christof - I've been thinking about this the last few days. We can ameliorate this in libc++, (See Richard's suggestion on __version) but anything we do will be a short-term solution. The first time someone includes another header file that #include , they're back to square one. That header is supposed to be "the place to go" for information about your standard library, and people are going to use it. For example, I expect that Boost.Config will start using it soon (if it doesn't already) A better solution (and not just because it would require other people to do the work) would be to have the build systems either: * Stop using VERSION as a file name - use something like VERSION.STAMP instead. * Use '-iquote' instead of '-I' to manage the list of include directories. I agree that it's annoying for people's builds to be broken when they upgrade their development tools, and especially when they didn't do anything "wrong". -- Marshall ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c49866a - [clang] stop baremetal driver to append .a to lib
Author: Christof Douma Date: 2020-02-13T11:08:46Z New Revision: c49866acceb1ffbcc0f723993648f0678e92a91c URL: https://github.com/llvm/llvm-project/commit/c49866acceb1ffbcc0f723993648f0678e92a91c DIFF: https://github.com/llvm/llvm-project/commit/c49866acceb1ffbcc0f723993648f0678e92a91c.diff LOG: [clang] stop baremetal driver to append .a to lib When the clang baremetal driver selects the rt.builtins static library it prefix with "-l" and appends ".a". The result is a nonsense option which lld refuses to accept. Differential Revision: https://reviews.llvm.org/D73904 Change-Id: Ic753b6104e259fbbdc059b68fccd9b933092d828 Added: Modified: clang/lib/Driver/ToolChains/BareMetal.cpp clang/test/Driver/arm-compiler-rt.c clang/test/Driver/baremetal.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp b/clang/lib/Driver/ToolChains/BareMetal.cpp index 7c302720c410..95f46b489e46 100644 --- a/clang/lib/Driver/ToolChains/BareMetal.cpp +++ b/clang/lib/Driver/ToolChains/BareMetal.cpp @@ -157,7 +157,7 @@ void BareMetal::AddCXXStdlibLibArgs(const ArgList &Args, void BareMetal::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs) const { CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" + - getTriple().getArchName() + ".a")); + getTriple().getArchName())); } void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA, diff --git a/clang/test/Driver/arm-compiler-rt.c b/clang/test/Driver/arm-compiler-rt.c index b1acd6d67363..f9de71a8c101 100644 --- a/clang/test/Driver/arm-compiler-rt.c +++ b/clang/test/Driver/arm-compiler-rt.c @@ -1,3 +1,10 @@ +// RUN: %clang -target arm-none-eabi \ +// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ +// RUN: -rtlib=compiler-rt -### %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix ARM-EABI +// ARM-EABI: "-L{{.*[/\\]}}Inputs/resource_dir_with_arch_subdir/lib/baremetal" +// ARM-EABI: "-lclang_rt.builtins-arm" + // RUN: %clang -target arm-linux-gnueabi \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ // RUN: -rtlib=compiler-rt -### %s 2>&1 \ diff --git a/clang/test/Driver/baremetal.cpp b/clang/test/Driver/baremetal.cpp index 68031fede72c..3ef5a56425a3 100644 --- a/clang/test/Driver/baremetal.cpp +++ b/clang/test/Driver/baremetal.cpp @@ -13,7 +13,7 @@ // CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" // CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal" // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for" -// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" +// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" // CHECK-V6M-C-SAME: "-o" "{{.*}}.o" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -35,7 +35,7 @@ // CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" // CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal" // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind" -// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" +// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o" // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -48,7 +48,7 @@ // CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" // CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal" // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind" -// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" +// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o" // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -61,7 +61,7 @@ // CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic" // CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal" // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind" -// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" +// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m" // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o" // RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r306384 - Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""
Author: christof Date: Tue Jun 27 02:50:38 2017 New Revision: 306384 URL: http://llvm.org/viewvc/llvm-project?rev=306384&view=rev Log: Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"" This reverts commit r305688 meaning it reintroduces r305684. To repeat: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. This breaks clang-tidy and clng-query which will be fixed in a commit soon after. Patch by Sanne Wouda Differential Revision: https://reviews.llvm.org/D31709 Modified: cfe/trunk/include/clang/Basic/SourceLocation.h cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h cfe/trunk/include/clang/Frontend/TextDiagnostic.h cfe/trunk/lib/Basic/SourceLocation.cpp cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp cfe/trunk/lib/Frontend/TextDiagnostic.cpp cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp cfe/trunk/tools/libclang/CIndexDiagnostic.cpp Modified: cfe/trunk/include/clang/Basic/SourceLocation.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=306384&r1=306383&r2=306384&view=diff == --- cfe/trunk/include/clang/Basic/SourceLocation.h (original) +++ cfe/trunk/include/clang/Basic/SourceLocation.h Tue Jun 27 02:50:38 2017 @@ -262,6 +262,65 @@ public: bool isInvalid() const { return !isValid(); } }; +/// \brief Represents an unpacked "presumed" location which can be presented +/// to the user. +/// +/// A 'presumed' location can be modified by \#line and GNU line marker +/// directives and is always the expansion point of a normal location. +/// +/// You can get a PresumedLoc from a SourceLocation with SourceManager. +class PresumedLoc { + const char *Filename; + unsigned Line, Col; + SourceLocation IncludeLoc; + +public: + PresumedLoc() : Filename(nullptr) {} + PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL) + : Filename(FN), Line(Ln), Col(Co), IncludeLoc(IL) {} + + /// \brief Return true if this object is invalid or uninitialized. + /// + /// This occurs when created with invalid source locations or when walking + /// off the top of a \#include stack. + bool isInvalid() const { return Filename == nullptr; } + bool isValid() const { return Filename != nullptr; } + + /// \brief Return the presumed filename of this location. + /// + /// This can be affected by \#line etc. + const char *getFilename() const { +assert(isValid()); +return Filename; + } + + /// \brief Return the presumed line number of this location. + /// + /// This can be affected by \#line etc. + unsigned getLine() const { +assert(isValid()); +return Line; + } + + /// \brief Return the presumed column number of this location. + /// + /// This cannot be affected by \#line, but is packaged here for convenience. + unsigned getColumn() const { +assert(isValid()); +return Col; + } + + /// \brief Return the presumed include location of this location. + /// + /// This can be affected by GNU linemarker directives. + SourceLocation getIncludeLoc() const { +assert(isValid()); +return IncludeLoc; + } +}; + +class FileEntry; + /// \brief A SourceLocation and its associated SourceManager. /// /// This is useful for argument passing to functions that expect both objects. @@ -274,6 +333,12 @@ public: explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} + bool hasManager() const { + bool hasSrcMgr = SrcMgr != nullptr; + assert(hasSrcMgr == isValid() && "FullSourceLoc has location but no manager"); + return hasSrcMgr; + } + /// \pre This FullSourceLoc has an associated SourceManager. const SourceManager &getManager() const { assert(SrcMgr && "SourceManager is NULL."); @@ -284,6 +349,13 @@ public: FullSourceLoc getExpansionLoc() const; FullSourceLoc getSpellingLoc() const; + FullSourceLoc getFileLoc() const; + std::pair getImmediateExpansionRange() const; + PresumedLoc getPresumedLoc(bool UseLineDirectives = true) const; + bool isMacroArgExpansion(FullSourceLoc *StartLoc = nullptr) const; + FullSourceLoc getImmediateMacroCallerLoc() const; + std::pair getModuleImportLoc() const; + unsigned getFileOffset() const; unsigned getExpansionLineNumber(bool *Invalid = nullptr) const; unsigned getExpansionColumnNumber(bool *Invalid = nullptr) const; @@ -293,6 +365,12 @@ public: const char *getCharacterData(bool *Invalid = nullptr) const; + unsigned getLineNumber(bool *Invalid = nullptr) const; + unsigned getColumnNumber(bool *Invalid =
r296454 - [ARM] Don't pass -arm-execute-only to cc1as
Author: christof Date: Tue Feb 28 03:09:53 2017 New Revision: 296454 URL: http://llvm.org/viewvc/llvm-project?rev=296454&view=rev Log: [ARM] Don't pass -arm-execute-only to cc1as The option -mexecute-only is translated into the backend option -arm-execute-only. But this option only makes sense for the compiler and the assembler does not recognize it. This patch stops clang from passing this option to the assembler. Change-Id: I4f4cb1162c13cfd50a0a36702a4ecab1bc0324ba Review: https://reviews.llvm.org/D30414 Modified: cfe/trunk/lib/Driver/Arch/ARM.cpp cfe/trunk/test/Driver/arm-execute-only.c Modified: cfe/trunk/lib/Driver/Arch/ARM.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arch/ARM.cpp?rev=296454&r1=296453&r2=296454&view=diff == --- cfe/trunk/lib/Driver/Arch/ARM.cpp (original) +++ cfe/trunk/lib/Driver/Arch/ARM.cpp Tue Feb 28 03:09:53 2017 @@ -374,25 +374,28 @@ void arm::getARMTargetFeatures(const Too } // Generate execute-only output (no data access to code sections). - // Supported only on ARMv6T2 and ARMv7 and above. - // Cannot be combined with -mno-movt or -mlong-calls - if (Arg *A = Args.getLastArg(options::OPT_mexecute_only, options::OPT_mno_execute_only)) { -if (A->getOption().matches(options::OPT_mexecute_only)) { - if (getARMSubArchVersionNumber(Triple) < 7 && - llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::AK_ARMV6T2) -D.Diag(diag::err_target_unsupported_execute_only) << Triple.getArchName(); - else if (Arg *B = Args.getLastArg(options::OPT_mno_movt)) -D.Diag(diag::err_opt_not_valid_with_opt) << A->getAsString(Args) << B->getAsString(Args); - // Long calls create constant pool entries and have not yet been fixed up - // to play nicely with execute-only. Hence, they cannot be used in - // execute-only code for now - else if (Arg *B = Args.getLastArg(options::OPT_mlong_calls, options::OPT_mno_long_calls)) { -if (B->getOption().matches(options::OPT_mlong_calls)) + // This only makes sense for the compiler, not for the assembler. + if (!ForAS) { +// Supported only on ARMv6T2 and ARMv7 and above. +// Cannot be combined with -mno-movt or -mlong-calls +if (Arg *A = Args.getLastArg(options::OPT_mexecute_only, options::OPT_mno_execute_only)) { + if (A->getOption().matches(options::OPT_mexecute_only)) { +if (getARMSubArchVersionNumber(Triple) < 7 && +llvm::ARM::parseArch(Triple.getArchName()) != llvm::ARM::AK_ARMV6T2) + D.Diag(diag::err_target_unsupported_execute_only) << Triple.getArchName(); +else if (Arg *B = Args.getLastArg(options::OPT_mno_movt)) D.Diag(diag::err_opt_not_valid_with_opt) << A->getAsString(Args) << B->getAsString(Args); - } +// Long calls create constant pool entries and have not yet been fixed up +// to play nicely with execute-only. Hence, they cannot be used in +// execute-only code for now +else if (Arg *B = Args.getLastArg(options::OPT_mlong_calls, options::OPT_mno_long_calls)) { + if (B->getOption().matches(options::OPT_mlong_calls)) +D.Diag(diag::err_opt_not_valid_with_opt) << A->getAsString(Args) << B->getAsString(Args); +} - CmdArgs.push_back("-backend-option"); - CmdArgs.push_back("-arm-execute-only"); +CmdArgs.push_back("-backend-option"); +CmdArgs.push_back("-arm-execute-only"); + } } } Modified: cfe/trunk/test/Driver/arm-execute-only.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-execute-only.c?rev=296454&r1=296453&r2=296454&view=diff == --- cfe/trunk/test/Driver/arm-execute-only.c (original) +++ cfe/trunk/test/Driver/arm-execute-only.c Tue Feb 28 03:09:53 2017 @@ -90,6 +90,9 @@ // RUN: not %clang -target armv8m.main-eabi -mpure-code -mlong-calls %s 2>&1 \ // RUN:| FileCheck %s -check-prefix CHECK-EXECUTE-ONLY-LONG-CALLS +// RUN: %clang -target armv7m-eabi -x assembler -mexecute-only %s -c -### 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-NO-EXECUTE-ONLY -check-prefix CHECK-NO-EXECUTE-ONLY-ASM + // // CHECK-NO-EXECUTE-ONLY-NOT: "-backend-option" "-arm-execute-only" // CHECK-EXECUTE-ONLY: "-backend-option" "-arm-execute-only" @@ -97,3 +100,4 @@ // CHECK-EXECUTE-ONLY-NOT-SUPPORTED: error: execute only is not supported for the thumbv6m sub-architecture // CHECK-EXECUTE-ONLY-NO-MOVT: error: option '-mexecute-only' cannot be specified with '-mno-movt' // CHECK-EXECUTE-ONLY-LONG-CALLS: error: option '-mexecute-only' cannot be specified with '-mlong-calls' +// CHECK-NO-EXECUTE-ONLY-ASM: warning: argument unused during compilation: '-mexecute-only' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.o
[PATCH] D21082: Do not assume that -fsanitize=address is valid option in clang tests
christof created this revision. christof added reviewers: vitalybuka, chapuni. christof added a subscriber: cfe-commits. christof set the repository for this revision to rL LLVM. The asan tests should only run on builds that have LLVM_USE_SANITIZER set. The feature 'asan' reflects this and is required for test/CodeGen/lifetime-asan.c Repository: rL LLVM http://reviews.llvm.org/D21082 Files: test/CodeGen/lifetime-asan.c Index: test/CodeGen/lifetime-asan.c === --- test/CodeGen/lifetime-asan.c +++ test/CodeGen/lifetime-asan.c @@ -2,6 +2,7 @@ // RUN: %clang -S -emit-llvm -o - -O0 \ // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \ // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE +// REQUIRES: asan // UNSUPPORTED: mingw32 extern int bar(char *A, int n); Index: test/CodeGen/lifetime-asan.c === --- test/CodeGen/lifetime-asan.c +++ test/CodeGen/lifetime-asan.c @@ -2,6 +2,7 @@ // RUN: %clang -S -emit-llvm -o - -O0 \ // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \ // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE +// REQUIRES: asan // UNSUPPORTED: mingw32 extern int bar(char *A, int n); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21082: Do not assume that -fsanitize=address is valid option in clang tests
christof added a comment. In http://reviews.llvm.org/D21082#451393, @kubabrecka wrote: > This doesn’t make sense to me, Clang is able to produce ASanified code even > when the compiler itself isn’t ASanified (that’s what LLVM_USE_SANITIZER > does). Where exactly is this test failing? Right. I was confused about the meaning of that feature. The test fails with: clang-3.9: error: unsupported option '-fsanitize=address' for target 'aarch64-arm-none-eabi’ The patch suggested by vitalybuka seems to work. So I suggest we go for that. Repository: rL LLVM http://reviews.llvm.org/D21082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21117: Specify target in lifetime-asan test.
christof accepted this revision. christof added a reviewer: christof. christof added a comment. I've tested it and it removes the issue I saw. The following error is gone: clang-3.9: error: unsupported option '-fsanitize=address' for target 'aarch64-arm-none-eabi’ Thanks http://reviews.llvm.org/D21117 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15142: Teaches clang about Cortex-A35.
This revision was automatically updated to reflect the committed changes. Closed by commit rL254505: Teaches clang about Cortex-A35. (authored by christof). Changed prior to commit: http://reviews.llvm.org/D15142?vs=41600&id=41609#toc Repository: rL LLVM http://reviews.llvm.org/D15142 Files: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/CodeGen/arm-target-features.c cfe/trunk/test/Driver/aarch64-cpus.c cfe/trunk/test/Driver/arm-cortex-cpus.c cfe/trunk/test/Preprocessor/aarch64-target-features.c Index: cfe/trunk/test/Preprocessor/aarch64-target-features.c === --- cfe/trunk/test/Preprocessor/aarch64-target-features.c +++ cfe/trunk/test/Preprocessor/aarch64-target-features.c @@ -88,10 +88,12 @@ // CHECK-MTUNE-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+zcm" "-target-feature" "+zcz" // RUN: %clang -target aarch64 -mcpu=cyclone -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-CYCLONE %s +// RUN: %clang -target aarch64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A35 %s // RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A53 %s // RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A57 %s // RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A72 %s // CHECK-MCPU-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" +// CHECK-MCPU-A35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" // CHECK-MCPU-A53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" // CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" // CHECK-MCPU-A72: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" Index: cfe/trunk/test/CodeGen/arm-target-features.c === --- cfe/trunk/test/CodeGen/arm-target-features.c +++ cfe/trunk/test/CodeGen/arm-target-features.c @@ -22,6 +22,7 @@ // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 +// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a35 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 Index: cfe/trunk/test/Driver/arm-cortex-cpus.c === --- cfe/trunk/test/Driver/arm-cortex-cpus.c +++ cfe/trunk/test/Driver/arm-cortex-cpus.c @@ -394,33 +394,41 @@ // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s // CHECK-BE-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbebv7r-{{.*}} +// RUN: %clang -target arm -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s +// RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}} +// RUN: %clang -target armeb -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s +//
r254505 - Teaches clang about Cortex-A35.
Author: christof Date: Wed Dec 2 06:03:42 2015 New Revision: 254505 URL: http://llvm.org/viewvc/llvm-project?rev=254505&view=rev Log: Teaches clang about Cortex-A35. Adds support for the new Cortex-A35 ARMv8-A core. Differential Revision: http://reviews.llvm.org/D15142 Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/CodeGen/arm-target-features.c cfe/trunk/test/Driver/aarch64-cpus.c cfe/trunk/test/Driver/arm-cortex-cpus.c cfe/trunk/test/Preprocessor/aarch64-target-features.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=254505&r1=254504&r2=254505&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Wed Dec 2 06:03:42 2015 @@ -5311,7 +5311,7 @@ public: bool setCPU(const std::string &Name) override { bool CPUKnown = llvm::StringSwitch(Name) .Case("generic", true) -.Cases("cortex-a53", "cortex-a57", "cortex-a72", true) +.Cases("cortex-a53", "cortex-a57", "cortex-a72", "cortex-a35", true) .Case("cyclone", true) .Default(false); return CPUKnown; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=254505&r1=254504&r2=254505&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed Dec 2 06:03:42 2015 @@ -2057,7 +2057,7 @@ static bool DecodeAArch64Mcpu(const Driv std::pair Split = Mcpu.split("+"); CPU = Split.first; if (CPU == "cyclone" || CPU == "cortex-a53" || CPU == "cortex-a57" || - CPU == "cortex-a72") { + CPU == "cortex-a72" || CPU == "cortex-a35") { Features.push_back("+neon"); Features.push_back("+crc"); Features.push_back("+crypto"); Modified: cfe/trunk/test/CodeGen/arm-target-features.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-target-features.c?rev=254505&r1=254504&r2=254505&view=diff == --- cfe/trunk/test/CodeGen/arm-target-features.c (original) +++ cfe/trunk/test/CodeGen/arm-target-features.c Wed Dec 2 06:03:42 2015 @@ -22,6 +22,7 @@ // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 +// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a35 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 Modified: cfe/trunk/test/Driver/aarch64-cpus.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/aarch64-cpus.c?rev=254505&r1=254504&r2=254505&view=diff == --- cfe/trunk/test/Driver/aarch64-cpus.c (original) +++ cfe/trunk/test/Driver/aarch64-cpus.c Wed Dec 2 06:03:42 2015 @@ -18,6 +18,21 @@ // RUN: %clang -target arm64-apple-darwin -arch arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-DARWIN %s // ARM64-DARWIN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cyclone" +// RUN: %clang -target aarch64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// CA35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a35" + +// RUN: %clang -target arm64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// RUN: %clang -target arm64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// ARM64-CA35: "-cc1"{{.*}} "-
Re: [PATCH] D15664: Teaches clang about Exynos-M1
christof added a comment. LGTM. But since this is my first review, I would like somebody else to sign off on this as well. http://reviews.llvm.org/D15664 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits